Get Activity Instances (POST)

Query for historic activity instances that fulfill the given parameters.

Method

POST /history/activity-instance

Parameters

Query Parameters

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.

Request Body

A JSON object with the following properties:

Name Description
activityInstanceId Filter by activity instance id.
processInstanceId Filter by process instance id.
processDefinitionId Filter by process definition id.
executionId Filter by the id of the execution that executed the activity instance.
activityId Filter by the activity id (according to BPMN 2.0 XML).
activityName Filter by the activity name (according to BPMN 2.0 XML).
activityType Filter by activity type.
taskAssignee Only include activity instances that are user tasks and assigned to a given user.
finished Only include finished activity instances. Value may only be true, as false is the default behavior.
unfinished Only include unfinished activity instances. Value may only be true, as false is the default behavior.
canceled Only include canceled activity instances. Value may only be true, as false is the default behavior.
completeScope Only include activity instances which completed a scope. Value may only be true, as false is the default behavior.
startedBefore Restrict to instances that were started before the given date. The date must have the format yyyy-MM-dd'T'HH:mm:ss, e.g., 2013-01-23T14:42:45.
startedAfter Restrict to instances that were started after the given date. The date must have the format yyyy-MM-dd'T'HH:mm:ss, e.g., 2013-01-23T14:42:45.
finishedBefore Restrict to instances that were finished before the given date. The date must have the format yyyy-MM-dd'T'HH:mm:ss, e.g., 2013-01-23T14:42:45.
finishedAfter Restrict to instances that were finished after the given date. The date must have the format yyyy-MM-dd'T'HH:mm:ss, e.g., 2013-01-23T14:42:45.
tenantIdIn Filter by a list of tenant ids. An activity instance must have one of the given tenant ids. Must be a JSON array of Strings.
sorting A JSON array of criteria to sort the result by. Each element of the array is a JSON object that specifies one ordering. The position in the array identifies the rank of an ordering, i.e. whether it is primary, secondary, etc. The ordering objects have the following properties:
sortBy Mandatory. Sort the results lexicographically by a given criterion. Valid values are activityInstanceID, instanceId, executionId, activityId, activityName, activityType, startTime, endTime, duration, definitionId, occurrence and tenantId.
sortOrder Mandatory. Sort the results in a given order. Values may be asc for ascending order or desc for descending order.

Result

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

Name Value Description
id String The id of the activity instance.
parentActivityInstanceId String The id of the parent activity instance, for example a sub process instance.
activityId String The id of the activity that this object is an instance of.
activityName String The name of the activity that this object is an instance of.
activityType String The type of the activity that this object is an instance of.
processDefinitionKey String The key of the process definition that this activity instance belongs to.
processDefinitionId String The id of the process definition that this activity instance belongs to.
processInstanceId String The id of the process instance that this activity instance belongs to.
executionId String The id of the execution that executed this activity instance.
taskId String The id of the task that is associated to this activity instance. Is only set if the activity is a user task.
assignee String The assignee of the task that is associated to this activity instance. Is only set if the activity is a user task.
calledProcessInstanceId String The id of the called process instance. Is only set if the activity is a call activity and the called instance a process instance.
calledCaseInstanceId String The id of the called case instance. Is only set if the activity is a call activity and the called instance a case instance.
startTime String The time the instance was started. Has the format yyyy-MM-dd'T'HH:mm:ss.
endTime String The time the instance ended. Has the format yyyy-MM-dd'T'HH:mm:ss.
durationInMillis Number The time the instance took to finish (in milliseconds).
canceled Boolean If true, this activity instance is canceled.
completeScope Boolean If true, this activity instance did complete a BPMN 2.0 scope
tenantId String The tenant id of the activity 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

POST /history/activity-instance

Request Body:

{
  "activityType": "userTask",
  "taskAssignee": "peter",
  "sorting":
    [{"sortBy": "activityId",
    "sortOrder": "asc"
    },
    {"sortBy": "executionId",
    "sortOrder": "desc"
    }]
}

Response

[
  {
    "activityId": "anActivity",
    "activityName": "anActivityName",
    "activityType": "userTask",
    "assignee": "peter",
    "calledProcessInstanceId": "aHistoricCalledProcessInstanceId",
    "calledCaseInstanceId": null,
    "canceled": true,
    "completeScope": false,
    "durationInMillis": 2000,
    "endTime": "2013-04-23T18:42:43",
    "executionId": "anExecutionId",
    "id": "aHistoricActivityInstanceId",
    "parentActivityInstanceId": "aHistoricParentActivityInstanceId",
    "processDefinitionId": "aProcDefId",
    "processInstanceId": "aProcInstId",
    "startTime": "2013-04-23T11:20:43",
    "taskId": "aTaskId",
    "tenantId":null
  }
]

On this Page: