Page tree

Do you want an overview on Nexus' solutions, customer cases, contact information and more?

__

Skip to end of metadata
Go to start of metadata

This article describes the PRIME Process REST API which can be used to control processes in Nexus PRIME.

The API provides a simple RESTful interface for starting and proceeding processes and for exchanging data with it. The PRIME Process REST API is part of the application PRIME Explorer and will be available automatically after starting the server that hosts the application. 

Expand/Collapse All

How to use the PRIME Process REST API

See the following topics for more information on how to use the PRIME Process REST API: 

 Secure REST API calls with HTTPS

The REST API is secured by default. Therefore it is not possible for intruders to access data and functionality of the REST interface. The default configuration uses our internal authentication profile to authenticate the user and to perform the authorization. 

By default, the HTTP Basic Authentication is used. The client calling our service is responsible to fill the Authorization Header of the HTTP request.

Never use the HTTP Basic Authentication without securing the communication channel using SSL, so make sure you access the server using HTTPS.

To configure the authentication process and the security settings, see the Spring Security filter settings in the security-beans.xml.

 Set the root context in the API call

The root context is the base context for all webservice requests. Specific requests must construct a path consisting of this base context plus the specific functionality.

contextURL

root context with https

[root_context] = https://[host]:[port]/[application_name]/ws

process interface

[root_context]/processes/

task interface

[root_context]/tasks/

tenant selection


Depending on the configuration of your server and authorization mechanism, the protocol can be HTTP or HTTPS. For more information, see the previous section. 

Make sure you specify the right port for your application server. 

 Select a tenant in the API call

To select the tenant id, append the tenant id to the URL, that is, the primary key of the tenant in the database: 

  • [URL]?tenantId=xxx


Example: Start process with tenant selection
http://myServer:8080/prime_explorer/ws/processes/MyProcess/start?tenantId=1234
 Resolve secrets over the REST API

By default, no secrets are resolved when querying for example the data map of a certain process step.

If the user which calls the REST API has the EXECUTION permission api.resolveSecrets, which can be defined in the designer, then secrets are resolved. The field is the same as the one which would contain the UUID of the secretFieldStore, for example Person_PasswordRef.

 Find task ID

To run a command on a specific task, you will need a taskId.

To find the taskId, look up the value of the id attribute of the specific process in the BPMN 2.0 process definition, in the file process.xml.

Or, if you rather want to get the information from the database, look into the table ACT_RU_TASK in the column Task_Def_Key_. Don´t use ID_.

Available commands

Start process

 POST [root_context]/processes/{processDefinitionKey}/start

Description

Starts the process defined by processDefinitionKey.

URL

[root_context]/processes/{processDefinitionKey}/start

where processDefinitionKey is the ID of the BPMN process.

Method

POST

Content Type

application/xml


Header Parameters

ParameterDescriptionRequired or Optional
Authorization

To pass authentication information to the server, we use the HTTP basic authentication. The authorization information is passed as HTTP header parameter in the form username:password Base64 encoded (admin:admin in the following example):

Authorization: Basic YWRtaW46YWRtaW4=

Required
Accept-Language

If the exception which can occur on the server is translatable you can determine the output language of the exception message with this parameter:

Accept-Language: en

Optional


Request Parameters

Multiple Request Parameters can be concatenated with "&"

ParameterDescriptionRequired or Optional
?searchConfigName=myNameThis query parameter identifies the search configuration for searching for one core object. Optional

?tenantId=myTenant

This query parameter identifies the tenant for which the process should be started. This information is also used to authenticate the user (depending on the authorization mechanism).Required


Body

The request body can be used to fill the data map for the process which shall be started. The form should be like:

<data>
	<field name="BaseDpEmployee_FirstName">Max<field>
	<field name="BaseDbEmployee_Photo">{base64EncodedPhoto}</field>
</data>


Response

In case of an Error you'll get the following status codes:

  • 400 - Bad Request
  • 500 - Internal Server error


Example responses

Example: Error response with http status code 500
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<restError>
    <message>No core template with name "null" was found.</message>
</restError>


Example: Successful response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<process instanceId="4711"/>


Execute task

 POST [root_context]/tasks/{processInstanceId}/{taskId}

Description

Executes a task for a process instance. The process instance for which the task should be executed is given by the passed processInstanceId. The task to execute is given by the passed task id.

URL

[root_context]/tasks/{processInstanceId}/{taskId}

To find the task id, look up the id of the task in the BPMN 2.0 process definition.

Method

POST

Content Type

application/xml

Header Parameters

ParameterDescriptionRequired or Optional
Authorization

To pass authentication information to the server, we use the HTTP basic authentication. The authorization information is passed as HTTP header parameter in the form username:password Base64 encoded (admin:admin in the following example):

Authorization: Basic YWRtaW46YWRtaW4=

Required
Accept-Language

If the exception which can occur on the server is translatable you can determine the output language of the exception message with this parameter:

Accept-Language: en

Optional


Response

In case of an Error you'll get the following status codes:

  • 400 - Bad Request
  • 500 - Internal Server error


Example responses

Example: Error response with http status code 500
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<restError>
    <message>No core template with name "null" was found.</message>
</restError>


Example: Successful response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<process instanceId="4711"/>


Obtain task data

 GET [root_context]/tasks/{processInstanceId}/{taskId}/data

Description

Obtains the data map of a task for a given process instance. The process instance is given by the parameter processInstanceId. The task which data has to be obtained is given by the passed taskId.

URL

[root_context]/tasks/{processInstanceId}/{taskId}/data

Method

GET


Header Parameters

ParameterDescriptionRequired or Optional
Authorization

To pass authentication information to the server, we use the HTTP basic authentication. The authorization information is passed as HTTP header parameter in the form username:password Base64 encoded (admin:admin in the following example):

Authorization: Basic YWRtaW46YWRtaW4=

Required
Accept-Language

If the exception which can occur on the server is translatable you can determine the output language of the exception message with this parameter:

Accept-Language: en

Optional


Example response

Example: Successful response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data>
    <field name="Person_Email">max.muster@nexusgroup.de</field>
    <field name="Person_FirstName">Max</field>
    <field name="Person_Id">5678</field>
    <field name="Person_LastName">Muster</field>
    <field name="Meta_CoreTemplateName_Person">Person</field>
    <field name="Person_PersonnelNumber">123456</field>
</data>