Queries for the number of historic process instances that fulfill the given parameters.This method takes the same message body as the Get Process Instances (POST) method and therefore it is slightly more powerful than the Get Process Instance Count method.

Method

POST /history/process-instance/count

Parameters

Request Body

A JSON object with the following properties:

Name Description
processInstanceId Filter by process instance id.
processInstanceIds Filter by process instance ids. Must be a comma-separated list of process instance ids.
processInstanceBusinessKey Filter by process instance business key.
processInstanceBusinessKeyLike Filter by process instance business key that the parameter is a substring of.
superProcessInstanceId Restrict query to all process instances that are sub process instances of the given process instance. Takes a process instance id.
subProcessInstanceId Restrict query to one process instance that has a sub process instance with the given id.
superCaseInstanceId Restrict query to all process instances that are sub process instances of the given case instance. Takes a case instance id.
subCaseInstanceId Restrict query to one process instance that has a sub case instance with the given id.
caseInstanceId Restrict query to all process instances that are sub process instances of the given case instance. Takes a 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.
processDefinitionKeyNotIn Exclude instances that belong to a set of process definitions. Must be a comma-separated list of process definition keys.
processDefinitionName Filter by the name of the process definition the instances run on.
processDefinitionNameLike Filter by process definition names that the parameter is a substring of.
finished Only include finished process instances. Value may only be true, as false is the default behavior.
unfinished Only include unfinished process instances. Value may only be true, as false is the default behavior.
incidentType Filter by the incident type. See the User Guide for a list of incident types.
withIncidents Only include process instances which have an incident. Value may only be true, as false is the default behavior.
withRootIncidents Only include process instances which have a root incident. Value may only be true, as false is the default behavior.
incidentStatus Only include process instances which have an incident in status either open or resolved. To get all process instances, use the query parameter withIncidents.
incidentMessage Filter by the incident message. Exact match.
incidentMessageLike Filter by the incident message that the parameter is a substring of.
startedBy Only include process instances that were started by the given user.
startedBefore Restrict to instances 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 instances 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 instances 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 instances 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 list of tenant ids. A process instance must have one of the given tenant ids. Must be a JSON array of Strings.
variables A JSON array to only include process instances that have/had variables with certain values. The array consists of objects with the three properties name, operator and value. name (String) is the variable name, operator (String) is the comparison operator to be used and value the variable value. value may be String, Number or Boolean. 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.
executedActivityBefore Restrict to instances that executed an activity before the given date (inclusive). 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.
executedActivityAfter Restrict to instances that executed an activity after the given date (inclusive). 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.
executedActivityIdIn Restrict to instances that executed an activity with one of given ids.
activeActivityIdIn Restrict to instances that have an active activity with one of given ids.
executedJobBefore Restrict to instances that executed an job before the given date (inclusive). 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.
executedJobAfter Restrict to instances that executed an job after the given date (inclusive). 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.
active Restrict to instances that are active
suspended Restrict to instances that are suspended
completed Restrict to instances that are completed
externallyTerminated Restrict to instances that are externally terminated
internallyTerminated Restrict to instances that are internally terminated

Result

A JSON object that contains the count as the only property.

Name Value Description
count Number The number of matching historic process instances.

Response Codes

Code Media type Description
200 application/json Request successful.
400 application/json Returned if some of the query parameters are invalid. See the Introduction for the error response format.

Example

Request

POST /history/process-instance/count

Request Body:

  1. {
  2. "finishedAfter": "2013-01-01T00:00:00.000+0200",
  3. "finishedBefore": "2013-04-01T23:59:59.000+0200",
  4. "executedActivityAfter": "2013-03-23T13:42:44.000+0200",
  5. "variables": [
  6. {
  7. "name": "myVariable",
  8. "operator": "eq",
  9. "value": "camunda"
  10. },
  11. {
  12. "name": "mySecondVariable",
  13. "operator": "neq",
  14. "value": 124
  15. }
  16. ]
  17. }

Response

  1. {
  2. "count": 1
  3. }

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