Queries for process instances that fulfill given parameters.Parameters may be static as well as dynamic runtime properties of process instances.The size of the result set can be retrieved by using the Get Instance Count method.

Method

GET /process-instance

Parameters

Query Parameters

Name Description
processInstanceIds Filter by a comma-separated list of process instance ids.
businessKey Filter by process instance business key.
businessKeyLike Filter by process instance business key that the parameter is a substring of.
caseInstanceId Filter by case instance id.
processDefinitionId Filter by the process definition the instances run on.
processDefinitionKey Filter by the key of the process definition the instances run on.
deploymentId Filter by the deployment the id belongs to.
superProcessInstance Restrict query to all process instances that are sub process instances of the given process instance. Takes a process instance id.
subProcessInstance Restrict query to all process instances that have the given process instance as a sub process instance. Takes a process instance id.
superCaseInstance Restrict query to all process instances that are sub process instances of the given case instance. Takes a case instance id.
subCaseInstance Restrict query to all process instances that have the given case instance as a sub case instance. Takes a case instance id.
active Only include active process instances. Value may only be true, as false is the default behavior.
suspended Only include suspended process instances. Value may only be true, as false is the default behavior.
incidentId Filter by the incident id.
incidentType Filter by the incident type. See the User Guide for a list of incident types.
incidentMessage Filter by the incident message. Exact match.
incidentMessageLike Filter by the incident message that the parameter is a substring of.
tenantIdIn Filter by a comma-separated list of tenant ids. A process instance must have one of the given tenant ids.
withoutTenantId Only include process instances which belong to no tenant. Value may only be true, as false is the default behavior.
activityIdIn Filter by a comma-separated list of activity ids. A process instance must currently wait in a leaf activity with one of the given activity ids.
rootProcessInstances Restrict the query to all process instances that are top level process instances.
variables Only include 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.
sortBy Sort the results lexicographically by a given criterion. Valid values are instanceId, definitionKey, definitionId, tenantId and businessKey. 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 process instance objects.Each process instance object has the following properties:

Name Value Description
id String The id of the process instance.
definitionId String The id of the process definition that this process instance belongs to.
businessKey String The business key of the process instance.
caseInstanceId String The id of the case instance associated with the process instance.
ended Boolean A flag indicating whether the process instance has ended or not. Deprecated: will always be false!
suspended Boolean A flag indicating whether the process instance is suspended or not.
tenantId String The tenant id of the process 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, or if an invalid operator for variable comparison is used. See the Introduction for the error response format.

Example

Request

GET /process-instance?variables=myVariable_eq_camunda,mySecondVariable_neq_aBadValue

Response

  1. [{"links":[],
  2. "id":"anId",
  3. "definitionId":"aProcDefId",
  4. "businessKey":"aKey",
  5. "caseInstanceId":"aCaseInstanceId",
  6. "ended":false,
  7. "suspended":false,
  8. "tenantId":null}]

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