Query Process Instance By View

Query the list of process instance by process view.

Request Format

POST https://{apigw-address}/enos-bpm-service/v2.0/work/display-view/{displayViewKey}/process-instances/query

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 (URI)

Name

Location (Path/Query)

Mandatory/Optional

Data Type

Description

displayViewKey

Path

Mandatory

String

The process view key.

Request Parameters (Body)

Name

Mandatory/Optional

Data Type

Description

columns

Optional

DisplayViewColumnQueryRepresentation Struct Array

The structure array of the filter items in the process view column.

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

DisplayViewColumnQueryRepresentation Struct

Name

Mandatory/Optional

Data Type

Description

id

Mandatory

String

The process view column ID.

filter

Optional

String

The criteria to filter the process instance.

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

JSON 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).

Error Codes

Code

Description

33404

The process view column ID does not exist / The process view key does not exist.

Samples

Request Sample

url: https://{apigw-address}/enos-bpm-service/v2.0/work/display-view/{your_display_view_key}/process-instances/query

method: POST

headers: {"Authorization":"Bearer {your_access_token}"}

requestBody: {
  "pagination": {
    "current": 0,
    "pageSize": 3,
    "sorts": [
      {
        "field": "name",
        "order": "asc"
      }
    ],
  },
  "columns": [
    {
      "id": "your_display_view_column_id",
      "filter": "your_filter_word"
    }
  ]
}

Return Sample

{
  "code": 0,
  "msg": "",
  "data": {
    "pagination": {
      "current": 0,
      "pageSize":3,
      "total": 3,
      "sorts": [],
      "start": 0
    },
    "processInstances": [
      {
        "name": "john.smithTest",
        "startedBy": "john.smith",
        "started": 1606818878643,
        "processStatus": "inProgress",
        "taskName": "UserTask",
        "assignee": null,
        "completedTime": null,
        "terminatedTime": null,
        "terminatedBy": null,
        "processInstanceId": "d04dd109-33c0-11eb-ba35-629b53178e94"
      },
      {
        "name": "john.smithTest",
        "startedBy": "john.smith",
        "started": 1605876457091,
        "processStatus": "inProgress",
        "taskName": "UserTask",
        "assignee": "john.smith",
        "completedTime": null,
        "terminatedTime": null,
        "terminatedBy": null,
        "processInstanceId": "91491e23-2b2e-11eb-aa51-2ee421df69ea"
      },
      {
        "name": "john.smithTest",
        "startedBy": "john.smith",
        "started": 1605876375581,
        "processStatus": "inProgress",
        "taskName": "UserTask",
        "assignee": "john.smith",
        "completedTime": null,
        "terminatedTime": null,
        "terminatedBy": null,
        "processInstanceId": "60b3ad8d-2b2e-11eb-aa51-2ee421df69ea"
      }
    ]
  }
}

Java SDK Sample

public class BpmSdkTest{
    @Test
    public void queryProcessInstanceByViewTest() {
        String bearerToken = "your_bearer_token";
        String displayViewKey = "your_display_view_key";
        String columnId = "display_view_column_id";
        String filter = "display_view_column_filter";
        DisplayViewColumnQueryRepresentation column = new DisplayViewColumnQueryRepresentation(columnId, filter);
        Pagination pagination = new Pagination();
        pagination.setCurrent(0);
        pagination.setPageSize(3);
        DisplayViewProcessInstanceQueryRequest request = new DisplayViewProcessInstanceQueryRequest(displayViewKey,
                Collections.singletonList(column), pagination, bearerToken);
        DisplayViewProcessInstanceQueryResponse response = getPoseidon().getResponse(request,
                DisplayViewProcessInstanceQueryResponse.class);
        assertNotNull("response cannot be null", response);
    }
}