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

Method

POST /history/case-instance/count

Parameters

Request Body

A JSON object with the following properties:

Name Description
caseInstanceId Filter by case instance id.
caseInstanceIds Filter by case instance ids. Must be a JSON array of case instance ids.
caseDefinitionId Filter by the case definition the instances run on.
caseDefinitionKey Filter by the key of the case definition the instances run on.
caseDefinitionKeyNotIn Exclude instances that belong to a set of case definitions. Must be a JSON array of case definition keys.
caseDefinitionName Filter by the name of the case definition the instances run on.
caseDefinitionNameLike Filter by case definition names that the parameter is a substring of.
caseInstanceBusinessKey Filter by case instance business key.
caseInstanceBusinessKeyLike Filter by case instance business key that the parameter is a substring of.
caseActivityIdIn Filter by a list of case activity ids. A historic case instance must have historic case activity instances in at least one of the given case activity ids.
createdBefore Restrict to instances that were created 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.
createdAfter Restrict to instances that were created 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.
closedBefore Restrict to instances that were closed 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.
closedAfter Restrict to instances that were closed 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.
createdBy Only include case instances that were created by the given user.
superCaseInstanceId Restrict query to all case instances that are sub case instances of the given case instance. Takes a case instance id.
subCaseInstanceId Restrict query to one case instance that has a sub case instance with the given id.
superProcessInstanceId Restrict query to all case instances that are sub case instances of the given process instance. Takes a process instance id.
subProcessInstanceId Restrict query to one case instance that has a sub process instance with the given id.
tenantIdIn Filter by a list of tenant ids. A case instance must have one of the given tenant ids. Must be a JSON array of Strings.
withoutTenantId Only include historic case instances which belong to no tenant. Value may only be true, as false is the default behavior.
active Only include active case instances. Value may only be true, as false is the default behavior.
completed Only include completed case instances. Value may only be true, as false is the default behavior.
terminated Only include terminated case instances. Value may only be true, as false is the default behavior.
closed Only include closed case instances. Value may only be true, as false is the default behavior.
notClosed Only include not closed case instances. Value may only be true, as false is the default behavior.
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.

Result

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

Name Value Description
count Number The number of matching historic case 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/case-instance/count

Request Body:

  1. {
  2. "caseInstanceIds": [
  3. "aCaseInstId",
  4. "anotherId"
  5. ],
  6. "closedAfter": "2013-01-01T00:00:00.000+0200",
  7. "closedBefore": "2013-04-01T23:59:59.000+0200"
  8. }

Response

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

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