Get Case Instances (POST)

Queries for case instances that fulfill given parameters through a JSON object. This method is slightly more powerful than the Get Case Instances method because it allows to filter by multiple case variables of types String, Number or Boolean.

Method

POST /case-instance

Parameters

Query Parameters

Name Description
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 a case instance id.
businessKey Filter by case instance business key.
caseDefinitionId Filter by the case definition the case instances run on.
caseDefinitionKey Filter by the key of the case definition the case instances run on.
deploymentId Filter by the deployment the id belongs to.
superProcessInstance Restrict query to all case instances that are sub case instances of the given process instance. Takes a process instance id.
subProcessInstance Restrict query to all case instances that have the given process instance as a sub process instance. Takes a process instance id.
superCaseInstance Restrict query to all case instances that are sub case instances of the given case instance. Takes a case instance id.
subCaseInstance Restrict query to all case instances that have the given case instance as a sub case instance. Takes a case instance id.
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.
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 case instances which belong to no tenant. Value may only be true, as false is the default behavior.
variables A JSON array to only include case instances that have 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.
variableNamesIgnoreCase Match all variable names provided in variables case-insensitively. If set to true variableName and variablename are treated as equal.
variableValuesIgnoreCase Match all variable values provided in variables case-insensitively. If set to true variableValue and variablevalue are treated as equal.
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 caseInstanceId, caseDefinitionKey, caseDefinitionId and tenantId.
sortOrder Mandatory. Sort the results in a given order. Values may be asc for ascending order or desc for descending order.

Result

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

Name Value Description
id String The id of the case instance.
caseDefinitionId String The id of the case definition that this case instance belongs to.
businessKey String The business key of the case instance.
active Boolean A flag indicating whether the case instance is active or not.
completed Boolean A flag indicating whether the case instance is completed or not.
tenantId String The tenant id of the case 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

POST /case-instance

Request Body:

{
  "variables":
    [
      {
        "name" : "myVariable",
        "operator" : "eq",
        "value" : "camunda"
      },
      {
        "name" : "mySecondVariable",
        "operator" : "neq",
        "value" : 124
      }
    ],
  "caseDefinitionId" : "acaseDefinitionId",
  "sorting":
    [
      {
        "sortBy": "caseDefinitionKey",
        "sortOrder": "asc"
      },
      {
        "sortBy": "caseInstanceId",
        "sortOrder": "asc"
      }
    ]
}

Response

[
  {
    "links" : [],
    "id" : "anId",
    "caseDefinitionId" : "aCaseDefinitionId",
    "businessKey" : "aKey",
    "active" : false,
    "completed" : false,
    "tenantId"  : null
  }
]

On this Page: