Query Task

Query the list of tasks.

Request Format

POST https://{apigw-address}/enos-bpm-service/v2.0/work/tasks/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 (Body)

Name

Mandatory/Optional

Data Type

Description

pagination

Optional

Pagination Struct

The pagination request.

processInstanceId

Optional

String

The process instance ID.

processName

Optional

String

The process name.

taskStatus

Mandatory

String

The task status (inProgress, completed, unclaimed).

taskName

Optional

String

The task name.

Response Parameters

Name

Data Type

Description

data

Data Struct

The details of the task.

Data Struct

Name

Data Type

Description

pagination

Pagination Struct

The pagination request.

taskRepresentations

TaskRepresentation Struct Array

The task 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. If the total number of tasks is less than the number of requested records per page (50 by default) and the first page is displayed currently, the system will not return 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).

TaskRepresentation Struct

Name

Data Type

Description

id

String

The task ID.

name

String

The task name.

description

String

The task description.

category

String

The task type.

assignee

UserRepresentation Struct

Information about the current task assignee.

created

Timestamp

The task creation time.

dueDate

Timestamp

The task due time.

endDate

Timestamp

The task end time.

duration

Long

The task duration.

priority

Integer

The task priority for task ordering.

processInstanceId

String

The process instance ID.

processInstanceName

String

The process instance name.

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.

scopeId

String

The scope ID.

scopeType

String

The scope type.

caseInstanceName

String

The CMMN instance name.

scopeDefinitionId

String

The scope definition ID.

caseDefinitionName

String

The CMMN definition name.

caseDefinitionDescription

String

The CMMN definition description.

caseDefinitionKey

String

The CMMN definition key.

caseDefinitionCategory

String

The CMMN definition type.

caseDefinitionVersion

String

The CMMN definition version number.

caseDefinitionDeploymentId

String

The deployment resource ID corresponding to the CMMN definition.

parentTaskId

String

The parent task ID (previous task).

parentTaskName

String

The parent task name.

formKey

String

The task form key.

processInstanceStartUserId

String

The user ID of the process instance starter.

candidateUsers

UserRepresentation Struct Array

Information about the candidate users for the task.

candidateGroups

String array

The candidate user group names for the task.

canClaim

Boolean

Whether the current user can claim this task.

canOperate

Boolean

Whether the current user can execute this task.

taskName

String

The name of current task.

createdTime

Timestamp

The task creation time.

completedTime

Timestamp

The task completion time.

taskStatus

String

The task status (inProgress, completed, unclaimed).

processName

String

The process name.

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.

email

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/tasks/query

method: POST

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

requestBody:{
  "pagination": {
    "current": 0,
    "pageSize": 2
  },
  "taskStatus": "inProgress"
}

Return Sample

{
  "code": 0,
  "msg": "",
  "data": {
    "pagination": {
      "current": 0,
      "pageSize": 2,
      "total": 21,
      "sorts": [],
      "start": 0
    },
    "taskRepresentations": [
      {
        "id": "4baecb74-e5d6-11ea-ba2a-62873ba48f97",
        "name": "固件上传审批",
        "description": null,
        "category": null,
        "assignee": {
          "id": "u15916978791551",
          "firstName": null,
          "lastName": null,
          "email": "john.smith@envision-digital.com",
          "fullName": "john.smith",
          "tenantId": "o15874765326651",
          "groups": [],
          "privileges": []
        },
        "created": 1598251914373,
        "dueDate": null,
        "endDate": null,
        "duration": null,
        "priority": 50,
        "processInstanceId": "4baea45a-e5d6-11ea-ba2a-62873ba48f97",
        "processInstanceName": "string",
        "processDefinitionId": "139d9ea3-d21e-11ea-9d02-b6917a6e9040",
        "processDefinitionName": "0730上传tag",
        "processDefinitionDescription": null,
        "processDefinitionKey": "a1411e0f9d21a11ea9d02b6917a6e9040",
        "processDefinitionCategory": "http://flowable.org/test",
        "processDefinitionVersion": 2,
        "processDefinitionDeploymentId": "12a29cd0-d21e-11ea-9d02-b6917a6e9040",
        "scopeId": null,
        "scopeType": null,
        "caseInstanceName": null,
        "scopeDefinitionId": null,
        "caseDefinitionName": null,
        "caseDefinitionDescription": null,
        "caseDefinitionKey": null,
        "caseDefinitionCategory": null,
        "caseDefinitionVersion": 0,
        "caseDefinitionDeploymentId": null,
        "parentTaskId": null,
        "parentTaskName": null,
        "formKey": "approvalopinion20200730",
        "processInstanceStartUserId": null,
        "candidateUsers": null,
        "candidateGroups": null,
        "canClaim": false,
        "canOperate": true,
        "taskName": "固件上传审批",
        "createdTime": 1598251914373,
        "processName": "0730上传tag",
        "taskStatus": "inProgress",
        "completedTime": null
      },
      {
        "id": "f7cea05e-e5d5-11ea-a7d0-2e79fed17589",
        "name": "固件上传审批",
        "description": null,
        "category": null,
        "assignee": {
          "id": "u15916978791551",
          "firstName": null,
          "lastName": null,
          "email": "john.smith@envision-digital.com",
          "fullName": "john.smith",
          "tenantId": "o15874765326651",
          "groups": [],
          "privileges": []
        },
        "created": 1598251773653,
        "dueDate": null,
        "endDate": null,
        "duration": null,
        "priority": 50,
        "processInstanceId": "f7ce7944-e5d5-11ea-a7d0-2e79fed17589",
        "processInstanceName": "string",
        "processDefinitionId": "139d9ea3-d21e-11ea-9d02-b6917a6e9040",
        "processDefinitionName": "0730上传tag",
        "processDefinitionDescription": null,
        "processDefinitionKey": "a1411e0f9d21a11ea9d02b6917a6e9040",
        "processDefinitionCategory": "http://flowable.org/test",
        "processDefinitionVersion": 2,
        "processDefinitionDeploymentId": "12a29cd0-d21e-11ea-9d02-b6917a6e9040",
        "scopeId": null,
        "scopeType": null,
        "caseInstanceName": null,
        "scopeDefinitionId": null,
        "caseDefinitionName": null,
        "caseDefinitionDescription": null,
        "caseDefinitionKey": null,
        "caseDefinitionCategory": null,
        "caseDefinitionVersion": 0,
        "caseDefinitionDeploymentId": null,
        "parentTaskId": null,
        "parentTaskName": null,
        "formKey": "approvalopinion20200730",
        "processInstanceStartUserId": null,
        "candidateUsers": null,
        "candidateGroups": null,
        "canClaim": false,
        "canOperate": true,
        "taskName": "固件上传审批",
        "createdTime": 1598251773653,
        "processName": "0730上传tag",
        "taskStatus": "inProgress",
        "completedTime": null
      }
    ]
  }
}

Java SDK Sample

public class BpmSdkTest{
    @Test
    public void queryTaskTest() {
        String bearerToken = "your_bearer_token";
        TaskCriteria criteria = new TaskCriteria();
        criteria.setProcessInstanceId("process_instance_id");
        criteria.setProcessName("process_name");
        criteria.setTaskStatus(TaskStatus.ALL);
        criteria.setTaskName("task_name");
        TaskQueryRequest request = new TaskQueryRequest(criteria, bearerToken);
        TaskQueryReponse response = Poseidon.config(PConfig.init().appKey("your_access_key")
                                            .appSecret("your_secret_key").debug()).url("https://{apigw-address}")
                                            .getResponse(request, TaskQueryReponse.class);
        assertNotNull("response cannot be null", response);
    }

}