Get Historic Case Instances (POST)

Queries for historic case instances that fulfill the given parameters.

Method

POST /history/case-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
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 belongs 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.
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:
Name Description
sortBy Mandatory. Sort the results lexicographically by a given criterion. Valid values are instanceId, definitionId, businessKey, createTime, closeTime, duration and tenantId.
sortOrder Mandatory. Sort the results in a given order. Values may be asc for ascending order or desc for descending order.

* For further information, please see the documentation.

Result

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

Name Value Description
id String The id of the case instance.
businessKey String The business key of the case instance.
caseDefinitionName String The name of the case definition that this case instance belongs to.
caseDefinitionKey String The key of the case definition that this case instance belongs to.
caseDefinitionId String The id of the case definition that this case instance belongs to.
createTime String The time the instance was created. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ.
closeTime String The time the instance was closed. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ.
durationInMillis Number The time the instance took to finish (in milliseconds).
createUserId String The id of the user who created the case instance.
superCaseInstanceId String The id of the parent case instance, if it exists.
superProcessInstanceId String The id of the parent process instance, if it exists.
tenantId String The tenant id of the case instance.
active Boolean If true, this case instance is active.
completed Boolean If true, this case instance is completed.
terminated Boolean If true, this case instance is terminated.
closed Boolean If true, this case instance is closed.

* For further information, please see the documentation.

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/case-instance

Request Body:

{
  "caseInstanceIds": [
    "aCaseInstId",
    "anotherId"
  ],
  "closedAfter": "2013-01-01T00:00:00.000+0200",
  "closedBefore": "2013-04-01T23:59:59.000+0200",
  "sorting":
    [{"sortBy": "businessKey",
    "sortOrder": "asc"
    },
    {"sortBy": "createTime",
    "sortOrder": "desc"
    }]
}

Response

[
  {
    "id": "aCaseInstId",
    "businessKey": "aKey",
    "caseDefinitionId": "aCaseDefId",
    "createTime": "2013-03-23T13:42:43.000+0200",
    "closeTime": "2013-03-23T13:42:45.000+0200",
    "durationInMillis": 2000,
    "createUserId": "aCreateUserId",
    "superCaseInstanceId": "aSuperCaseInstanceId",
    "superProcessInstanceId": null,
    "tenantId": null,
    "active": true,
    "completed": false,
    "terminated": false,
    "closed": false
  }
]

On this Page: