Queries for historic tasks that fulfill the given parameters.The size of the result set can be retrieved by using the Get Task Count method.

Method

GET /history/task

Parameters

Query Parameters

Name Description
taskId Filter by task id.
taskParentTaskId Filter by parent task id.
processInstanceId Filter by process instance id.
processInstanceBusinessKey Filter by process instance business key.
processInstanceBusinessKeyIn Filter by process instances with one of the give business keys. The keys need to be in a comma-separated list.
processInstanceBusinessKeyLike Filter by process instance business key that has the parameter value as a substring.
executionId Filter by the id of the execution that executed the task.
processDefinitionId Filter by process definition id.
processDefinitionKey Restrict to tasks that belong to a process definition with the given key.
processDefinitionName Restrict to tasks that belong to a process definition with the given name.
caseInstanceId Filter by case instance id.
caseExecutionId Filter by the id of the case execution that executed the task.
caseDefinitionId Filter by case definition id.
caseDefinitionKey Restrict to tasks that belong to a case definition with the given key.
caseDefinitionName Restrict to tasks that belong to a case definition with the given name.
activityInstanceIdIn Only include tasks which belong to one of the passed and comma-separated activity instance ids.
taskName Restrict to tasks that have the given name.
taskNameLike Restrict to tasks that have a name with the given parameter value as substring.
taskDescription Restrict to tasks that have the given description.
taskDescriptionLike Restrict to tasks that have a description that has the parameter value as a substring.
taskDefinitionKey Restrict to tasks that have the given key.
taskDefinitionKeyIn Restrict to tasks that have one of the passed and comma-separated task definition keys.
taskDeleteReason Restrict to tasks that have the given delete reason.
taskDeleteReasonLike Restrict to tasks that have a delete reason that has the parameter value as a substring.
taskAssignee Restrict to tasks that the given user is assigned to.
taskAssigneeLike Restrict to tasks that are assigned to users with the parameter value as a substring.
taskOwner Restrict to tasks that the given user owns.
taskOwnerLike Restrict to tasks that are owned by users with the parameter value as a substring.
taskPriority Restrict to tasks that have the given priority.
assigned If set to true, restricts the query to all tasks that are assigned.
unassigned If set to true, restricts the query to all tasks that are unassigned.
finished Only include finished tasks. Value may only be true, as false is the default behavior.
unfinished Only include unfinished tasks. Value may only be true, as false is the default behavior.
processFinished Only include tasks of finished processes. Value may only be true, as false is the default behavior.
processUnfinished Only include tasks of unfinished processes. Value may only be true, as false is the default behavior.
taskDueDate Restrict to tasks that are due on the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
taskDueDateBefore Restrict to tasks that are due before the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
taskDueDateAfter Restrict to tasks that are due after the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
taskFollowUpDate Restrict to tasks that have a followUp date on the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
taskFollowUpDateBefore Restrict to tasks that have a followUp date before the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
taskFollowUpDateAfter Restrict to tasks that have a followUp date after the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
startedBefore Restrict to tasks that were started before the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
startedAfter Restrict to tasks that were started after the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
finishedBefore Restrict to tasks that were finished before the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
finishedAfter Restrict to tasks that were finished after the given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200.
tenantIdIn Filter by a comma-separated list of tenant ids. A task instance must have one of the given tenant ids.
taskVariables Only include tasks that have variables with certain values. Variable filtering expressions are comma-separated and are structured as follows: A valid parameter value has the form key_operator_value. key is the variable name, operator is the comparison operator to be used and value the variable value.Note: Values are always treated as String objects on server side. Valid operator values are: eq - equal to; neq - not equal to; gt - greater than; gteq - greater than or equal to; lt - lower than; lteq - lower than or equal to; like. key and value may not contain underscore or comma characters.
processVariables Only include tasks that belong to process instances that have variables with certain values. Variable filtering expressions are comma-separated and are structured as follows: A valid parameter value has the form key_operator_value. key is the variable name, operator is the comparison operator to be used and value the variable value.Note: Values are always treated as String objects on server side. Valid operator values are: eq - equal to; neq - not equal to; gt - greater than; gteq - greater than or equal to; lt - lower than; lteq - lower than or equal to; like. key and value may not contain underscore or comma characters.
taskInvolvedUser Restrict to tasks with a historic identity link to the given user.
taskInvolvedGroup Restrict to tasks with a historic identity link to the given group.
taskHadCandidateUser Restrict to tasks with a historic identity link to the given candidate user.
taskHadCandidateGroup Restrict to tasks with a historic identity link to the given candidate group.
withCandidateGroups Only include tasks which have a candidate group. Value may only be true, as false is the default behavior.
withoutCandidateGroups Only include tasks which have no candidate group. Value may only be true, as false is the default behavior.
sortBy Sort the results by a given criterion. Valid values are taskId, activityInstanceID, processDefinitionId, processInstanceId, executionId, duration, endTime, startTime, taskName, taskDescription, assignee, owner, dueDate, followUpDate, deleteReason, taskDefinitionKey, priority, caseDefinitionId, caseInstanceId, caseExecutionId and tenantId. Must be used in conjunction with the sortOrder parameter.
sortOrder Sort the results in a given order. Values may be asc for ascending order or desc for descending order. Must be used in conjunction with the sortBy parameter.
firstResult Pagination of results. Specifies the index of the first result to return.
maxResults Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left.

Result

A JSON array of historic task objects.Each historic task object has the following properties:

Name Value Description
id String The task id.
processDefinitionKey String The key of the process definition the task belongs to.
processDefinitionId String The id of the process definition the task belongs to.
processInstanceId String The id of the process instance the task belongs to.
executionId String The id of the execution the task belongs to.
caseDefinitionKey String The key of the case definition the task belongs to.
caseDefinitionId String The id of the case definition the task belongs to.
caseInstanceId String The id of the case instance the task belongs to.
caseExecutionId String The id of the case execution the task belongs to.
activityInstanceId String The id of the activity that this object is an instance of.
name String The task name.
description String The task's description.
deleteReason String The task's delete reason.
owner String The owner's id.
assignee String The assignee's id.
startTime String The time the task was started. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ.
endTime String The time the task ended. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ.
duration Number The time the task took to finish (in milliseconds).
taskDefinitionKey String The task's key.
priority Number The task's priority.
due String The task's due date. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ.
parentTaskId String The id of the parent task, if this task is a subtask.
followUp String The follow-up date for the task. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ.
tenantId String The tenant id of the task instance.

Response Codes

Code Media type Description
200 application/json Request successful.
400 application/json Returned if some of the query parameters are invalid, for example if a sortOrder parameter is supplied, but no sortBy. See the Introduction for the error response format.

Example

Request

GET /history/task?taskAssignee=anAssignee&priority=42

Response

  1. [{"id":"anId",
  2. "processDefinitionId":"aProcDefId",
  3. "processInstanceId":"aProcInstId",
  4. "executionId":"anExecution",
  5. "caseDefinitionId":"aCaseDefId",
  6. "caseInstanceId":"aCaseInstId",
  7. "caseExecutionId":"aCaseExecution",
  8. "activityInstanceId": "anActInstId",
  9. "name":"aName",
  10. "description":"aDescription",
  11. "deleteReason": "aDeleteReason",
  12. "owner":"anOwner",
  13. "assignee":"anAssignee",
  14. "startTime":"2013-01-23T13:42:42.000+0200",
  15. "endTime":"2013-01-23T13:45:42.000+0200",
  16. "duration": 2000,
  17. "taskDefinitionKey":"aTaskDefinitionKey",
  18. "priority":42,
  19. "due":"2013-01-23T13:49:42.000+0200",
  20. "parentTaskId":"aParentId",
  21. "followUp:":"2013-01-23T13:44:42.000+0200",
  22. "tenantId":null}]

原文: https://docs.camunda.org/manual/7.9/reference/rest/history/task/get-task-query/