Query for the number of variable instances that fulfill given parameters. Takes the same parameters as the Get Variable Instances method.

Method

GET /variable-instance/count

Parameters

Query Parameters

Name Description
variableName Filter by variable instance name.
variableNameLike Filter by the variable instance name. The parameter can include the wildcard % to express like-strategy such as: starts with (%name), ends with (name%) or contains (%name%).
processInstanceIdIn Only include variable instances which belong to one of the passed and comma-separated process instance ids.
executionIdIn Only include variable instances which belong to one of the passed and comma-separated execution ids.
caseInstanceIdIn Only include variable instances which belong to one of the passed case instance ids.
caseExecutionIdIn Only include variable instances which belong to one of the passed case execution ids.
taskIdIn Only include variable instances which belong to one of the passed and comma-separated task ids.
activityInstanceIdIn Only include variable instances which belong to one of the passed and comma-separated activity instance ids.
tenantIdIn Only include variable instances which belong to one of the passed and comma-separated tenant ids.
variableValues Only include variable instances that have the certain values. Value 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 lexicographically by a given criterion. Valid values are variableName, variableType, activityInstanceId 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.

Result

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

Name Value Description
count Number The number of matching variable instances.

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

GET /variable-instance/count?processInstanceIdIn=aProcessInstanceId,anotherProcessInstanceId&variableValues=amount_gteq_5,amount_lteq_200

Response

  1. {"count": 3}

原文: https://docs.camunda.org/manual/7.9/reference/rest/variable-instance/get-query-count/