Query Process Instance¶
Query the list of process instances.
Request Format¶
POST https://{apigw-address}/enos-bpm-service/v2.0/work/process-instances/queryList
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 |
---|---|---|---|
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. If not specified, the default pagination size is 1000 pages, starting from 0. For more details, see Pagination Request Struct |
processName |
Optional |
String |
The process name. |
processStatus |
Mandatory |
String |
The process status (inProgress, completed, and terminated). |
processInstanceId |
Optional |
String |
The process instance ID. |
startedBefore |
Optional |
Timestamp |
Query processes that were started before this stated time. |
startedAfter |
Optional |
Timestamp |
Query processes that were started after this stated time. |
startBy |
Optional |
String |
The user ID of the process starter. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Data Struct |
List of process instances. |
Data Struct¶
Name |
Data Type |
Description |
---|---|---|
pagination |
Pagination Struct |
The pagination request. |
processInstances |
ProcessInstanceRepresentation Struct Array |
The process instance array. |
Pagination Struct¶
Name |
Data Type |
Description |
---|---|---|
current |
Integer |
The number of pages requested. |
pageSize |
Integer |
The number of records on each page. |
total |
Long |
The total number of records. |
sorts |
Sorter Struct Array |
The record sorting order. |
start |
Integer |
The serial number of the first record. |
Sorter Struct¶
Name |
Data Type |
Description |
---|---|---|
field |
String |
The sorting field. |
order |
String |
The sort order (asc, desc). |
ProcessInstanceRepresentation 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 current task assignee. |
taskName |
String |
The name of the 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. |
Samples¶
Request Sample¶
url: https://{apigw-address}/enos-bpm-service/v2.0/work/process-instances/queryList
method: POST
headers: {"Authorization":"Bearer {your_access_token}"}
requestBody: {
"pagination": {
"current": 0,
"pageSize": 10,
"sorts": [
{
"field": "name",
"order": "asc"
}
],
},
"processInstanceId": "your_process_instance_id",
"processName": "your_process_instance_name",
"processStatus": "inProgress",
}
Return Sample¶
{
"code": 0,
"msg": "",
"data": {
"pagination": {
"current": 0,
"pageSize": 2,
"total": 1075,
"sorts": [],
"start": 0
},
"processInstances": [
{
"id": "7407b133-e5f9-11ea-b677-0214d9689c6b",
"name": "0730升级tag",
"businessKey": "a74073c02e5f911eab6770214d9689c6b",
"processDefinitionId": "936272d4-e2d7-11ea-aa05-3ed0af00f194",
"tenantId": "o15874765326651",
"started": 1598267014450,
"ended": null,
"startedBy": {
"id": "u15977401032981",
"firstName": null,
"lastName": null,
"email": "john.smith@envision-digital.com",
"fullName": "john.smith",
"tenantId": "o15874765326651",
"groups": [],
"privileges": []
},
"processDefinitionName": "0730升级tag",
"processDefinitionDescription": null,
"processDefinitionKey": "afa317d3cd22d11ea8c5296a6822e2ce4",
"processDefinitionCategory": "http://flowable.org/test",
"processDefinitionVersion": 4,
"processDefinitionDeploymentId": "9259dc71-e2d7-11ea-aa05-3ed0af00f194",
"graphicalNotationDefined": true,
"startFormDefined": false,
"assignee": {
"id": "u15977401032981",
"firstName": null,
"lastName": null,
"email": "john.smith@envision-digital.com",
"fullName": "john.smith",
"tenantId": "o15874765326651",
"groups": [],
"privileges": []
},
"taskName": "固件升级审批",
"url": "https://beta-app-portal-cn4.eniot.io/portal/6b45e476-f5cd-4da9-a306-422cba0a9864/instance?state=route%3D%2Fworkflow-instance%2F7407b133-e5f9-11ea-b677-0214d9689c6b",
"terminable": null,
"terminatedBy": null,
"terminateReason": null,
"variables": [],
"processInstanceId": "7407b133-e5f9-11ea-b677-0214d9689c6b",
"createdTime": 1598267014450,
"processStatus": "inProgress",
"processName": "0730升级tag",
"completedTime": null,
"terminatedTime": null
},
{
"id": "60986949-e5f9-11ea-b8f9-02420a05d432",
"name": "test_all",
"businessKey": "a60981b28e5f911eab8f902420a05d432",
"processDefinitionId": "bb02d8d3-e5f7-11ea-b8f9-02420a05d432",
"tenantId": "o15874765326651",
"started": 1598266981844,
"ended": null,
"startedBy": {
"id": "u15977401032981",
"firstName": null,
"lastName": null,
"email": "john.smith@envision-digital.com",
"fullName": "john.smith",
"tenantId": "o15874765326651",
"groups": [],
"privileges": []
},
"processDefinitionName": "test_all",
"processDefinitionDescription": null,
"processDefinitionKey": "aba14eccde5eb11eab6770214d9689c6b",
"processDefinitionCategory": "http://flowable.org/test",
"processDefinitionVersion": 3,
"processDefinitionDeploymentId": "bae39100-e5f7-11ea-b8f9-02420a05d432",
"graphicalNotationDefined": true,
"startFormDefined": false,
"assignee": {
"id": "u15977401032981",
"firstName": null,
"lastName": null,
"email": "john.smith@envision-digital.com",
"fullName": "john.smith",
"tenantId": "o15874765326651",
"groups": [],
"privileges": []
},
"taskName": "用户任务",
"url": "https://beta-app-portal-cn4.eniot.io/portal/6b45e476-f5cd-4da9-a306-422cba0a9864/instance?state=route%3D%2Fworkflow-instance%2F60986949-e5f9-11ea-b8f9-02420a05d432",
"terminable": null,
"terminatedBy": null,
"terminateReason": null,
"variables": [],
"processInstanceId": "60986949-e5f9-11ea-b8f9-02420a05d432",
"createdTime": 1598266981844,
"processStatus": "inProgress",
"processName": "test_all",
"completedTime": null,
"terminatedTime": null
}
]
}
}
Java SDK Sample¶
public class BpmSdkTest{
@Test
public void queryProcessInstanceTest() {
String bearerToken = "your_bearer_token";
ProcessInstanceCriteria criteria = new ProcessInstanceCriteria();
criteria.setProcessStatus(ProcessStatus.IN_PROGRESS);
ProcessInstanceQueryRequest request = new ProcessInstanceQueryRequest(criteria, bearerToken);
ProcessInstanceQueryResponse response = Poseidon.config(PConfig.init().appKey("your_access_key")
.appSecret("your_secret_key").debug()).url("https://{apigw-address}")
.getResponse(request, ProcessInstanceQueryResponse.class);
assertNotNull("response cannot be null", response);
}
}