Start Process Instance¶
Start a new process instance.
Request Format¶
POST https://{apigw-address}/enos-bpm-service/v2.0/work/process-instances
Request Parameters (Header)¶
Name |
Location |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
Authorization |
Header |
Mandatory |
String |
The access token, which is represented by the bearer token. It can be obtained by invoking the Log In or Refresh Access Token API. |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
processDefinitionId |
Mandatory |
String |
The process definition ID. |
name |
Optional |
String |
The process name. |
formId |
Optional |
String |
The ID of the submitted form. |
values |
Mandatory |
Map (String for key, Object for value) |
The data in the submitted form, where the key is the form variable name, and the value is the submitted form value. |
outcome |
Optional |
String |
The form result string. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Data Struct |
The details of the process instance. |
Data Struct¶
Name |
Data Type |
Description |
---|---|---|
id |
String |
The process instance ID. |
name |
String |
The process name. |
businessKey |
String |
The key of the process instance. |
processDefinitionId |
String |
The process definition ID. |
processDefinitionName |
String |
The process definition name. |
processDefinitionDescription |
String |
The process definition description. |
processDefinitionKey |
String |
The process definition key. |
processDefinitionCategory |
String |
The process definition type. |
processDefinitionVersion |
Integer |
The process definition version number. |
processDefinitionDeploymentId |
String |
The deployment resource ID corresponding to the process definition. |
graphicalNotationDefined |
Boolean |
Whether to define the process icon. |
startFormDefined |
Boolean |
Whether to define the process start form. |
tenantId |
String |
The organization ID. |
createdTime |
Timestamp |
The creation time of the process instance. |
completedTime |
Timestamp |
The end time of the process instance. |
terminable |
Boolean |
Whether the current process can be terminated by the current user. |
terminatedTime |
Timestamp |
The termination time of the process instance. |
terminateReason |
String |
The reason for terminating the process instance. |
startedBy |
UserRepresentation Struct |
Information about the process starter. |
terminatedBy |
UserRepresentation Struct |
Information about the process terminator. |
assignee |
UserRepresentation Struct |
Information about the current task assignee. |
taskName |
String |
The name of current task. |
url |
String |
The URL of the process details in the BPM application. |
UserRepresentation Struct¶
Name |
Data Type |
Description |
---|---|---|
id |
String |
The user ID. |
firstName |
String |
The user’s first name. |
lastName |
String |
The user’s last name. |
String |
The user’s email. |
|
fullName |
String |
The user’s full name. |
tenantId |
String |
The organization ID. |
groups |
UserRepresentation Struct Array |
The user group. |
privileges |
String array |
The user permissions. |
GroupRepresentation Struct¶
Name |
Data Type |
Description |
---|---|---|
id |
String |
The user group ID. |
name |
String |
The user group name. |
type |
String |
The user group type. |
Error Codes¶
Code |
Description |
---|---|
33400 |
The process definition ID is empty. |
33403 |
The user does not have the permission to create this process instance. |
33500 |
The required fields are empty. |
Samples¶
Request Sample¶
url: https://{apigw-address}/enos-bpm-service/v2.0/work/process-instances
method: POST
headers: {"Authorization":"Bearer {your_access_token}"}
requestBody:
{
"processDefinitionId": "your_process_definition_id",
"name": "your_process_definition_name",
"formId": "task_form_id",
"outcome": "form_outcome",
"values": {
"field1": "value1",
"field2": "value2"
}
}
Return Sample¶
{
"code": 0,
"msg": "",
"data": {
"id": "43560586-e629-11ea-b8f9-02420a05d432",
"name": "c10sProcessTerminationTest",
"businessKey": "a43551b25e62911eab8f902420a05d432",
"processDefinitionId": "c9389796-e396-11ea-befd-92ab641570c6",
"tenantId": "o15874765326651",
"started": null,
"ended": null,
"startedBy": {
"id": "u15916978791551",
"firstName": null,
"lastName": null,
"email": "john.smith@envision-digital.com",
"fullName": "john.smith",
"tenantId": "o15874765326651",
"groups": [],
"privileges": []
},
"processDefinitionName": "c10sProcessTerminationTest",
"processDefinitionDescription": null,
"processDefinitionKey": "ab448ac59d7b711eab60886111ce5630f",
"processDefinitionCategory": "http://flowable.org/test",
"processDefinitionVersion": 4,
"processDefinitionDeploymentId": "c8d82813-e396-11ea-befd-92ab641570c6",
"graphicalNotationDefined": true,
"startFormDefined": false,
"assignee": null,
"taskName": null,
"url": null,
"terminable": null,
"terminatedBy": null,
"terminateReason": null,
"variables": [],
"processInstanceId": "43560586-e629-11ea-b8f9-02420a05d432",
"completedTime": null,
"terminatedTime": null,
"processName": "c10sProcessTerminationTest",
"createdTime": null,
"processStatus": "inProgress"
}
}
Java SDK Sample¶
public class BpmSdkTest{
@Test
public void startProcessInstanceTest() {
String bearerToken = "your_bearer_token";
CreateProcessInstanceRepresentation createProcessInstanceRepresentation = new CreateProcessInstanceRepresentation();
createProcessInstanceRepresentation.setName("your_process_definition_name");
createProcessInstanceRepresentation.setProcessDefinitionId("your_process_definition_id");
createProcessInstanceRepresentation.setFormId("form_id");
createProcessInstanceRepresentation.setOutcome("the_outcome_of_form");
Map<String, Object> values = new HashMap<>();
values.put("field1", "value1");
values.put("field2", "value2");
createProcessInstanceRepresentation.setValues(values);
ProcessInstanceStartRequest request = new ProcessInstanceStartRequest(createProcessInstanceRepresentation,
bearerToken);
ProcessInstanceStartResponse response = Poseidon.config(PConfig.init().appKey("your_access_key")
.appSecret("your_secret_key").debug()).url("https://{apigw-address}")
.getResponse(request, ProcessInstanceStartResponse.class);
assertNotNull("response cannot be null", response);
}
}