Queries for historic case instances that fulfill the given parameters. The size of the result set canbe retrieved by using the Get Historic Case Instance Count method.
Method
GET /history/case-instance
Parameters
Query Parameters
Name | Description |
---|---|
caseInstanceId | Filter by case instance id. |
caseInstanceIds | Filter by case instance ids. Must be a comma-separated list 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 comma-separated list 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 comma-separated 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'HHss.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'HHss.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'HHss.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'HHss.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 comma-separated list of tenant ids. A case instance must have one of the given tenant ids. |
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 | Only include process instances that have/had 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 by a given criterion. Valid values are instanceId , definitionId , businessKey , createTime , closeTime , duration and tenantId . 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. |
- 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'HHss.SSSZ . |
closeTime | String | The time the instance was closed. Default format* yyyy-MM-dd'T'HHss.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
GET /history/case-instance?closedAfter=2013-01-01T00:00:00.000+0200&closedBefore=2013-04-01T23:59:59.000+0200
Response
[
{
"id": "aCaseInstId",
"businessKey": "aKey",
"caseDefinitionId": "aCaseDefId",
"createTime": "2013-03-23T13:42:43.863+0200",
"closeTime": "2013-03-23T13:42:45.726+0200",
"durationInMillis": 2000,
"createUserId": "aStartUserId",
"superCaseInstanceId": "aSuperCaseInstanceId",
"superProcessInstanceId": null,
"tenantId": null,
"active": true,
"completed": false,
"terminated": false,
"closed": false
}
]
原文: https://docs.camunda.org/manual/7.9/reference/rest/history/case-instance/get-case-instance-query/