Queries for historic variable instances that fulfill the given parameters.This method is slightly more powerful than the Get Variable Instances method because it allows filtering by variable values of the different types String, Number or Boolean.

Method

POST /history/variable-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.
|deserializeValues| Determines whether serializable variable values (typically variables that store custom Java objects) should be deserialized on server side (default true).
If set to true, a serializable variable will be deserialized on server side and transformed to JSON using Jackson's POJO/bean property introspection feature. Note that this requires the Java classes of the variable value to be on the REST API's classpath.

If set to false, a serializable variable will be returned in its serialized format. For example, a variable that is serialized as XML will be returned as a JSON string containing XML.

Note: While true is the default value for reasons of backward compatibility, we recommend setting this parameter to false when developing web applications that are independent of the Java process applications deployed to the engine.

Request Body

A JSON object with the following properties:

Name Description
variableName Filter by variable name.
variableNameLike Restrict to variables with a name like the parameter.
variableValue Filter by variable value. May be String, Number or Boolean.
variableTypeIn Only include historic variable instances which belong to one of the passed and comma-separated variable types. A list of all supported variable types can be found here. Note: All non-primitive variables are assoziated with the type "serializable".
includeDeleted Include variables that has already been deleted during the execution.
processInstanceId Filter by the process instance the variable belongs to.
processInstanceIdIn Only include historic variable instances which belong to one of the passed process instance ids.
processDefinitionId Filter by the process definition the variable belongs to.
processDefinitionKey Filter by a key of the process definition the variable belongs to.
executionIdIn Only include historic variable instances which belong to one of the passed execution ids.
caseInstanceId Filter by the case instance the variable belongs to.
caseExecutionIdIn Only include historic variable instances which belong to one of the passed case execution ids.
caseActivityIdIn Only include historic variable instances which belong to one of the passed case activity ids.
taskIdIn Only include historic variable instances which belong to one of the passed task ids.
activityInstanceIdIn Only include historic variable instances which belong to one of the passed activity instance ids.
tenantIdIn Only include historic variable instances which belong to one of the passed and comma-separated tenant ids.
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:

sortByMandatory. Sort the results lexicographically by a given criterion. Valid values are instanceId and variableName and tenantId.
sortOrderMandatory. Sort the results in a given order. Values may be asc for ascending order or desc for descending order.

|sortBy|Mandatory. Sort the results lexicographically by a given criterion. Valid values are instanceId and variableName and tenantId. |sortOrder|Mandatory. Sort the results in a given order. Values may be asc for ascending order or desc for descending order.
|sortBy|Mandatory. Sort the results lexicographically by a given criterion. Valid values are instanceId and variableName 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 historic variable instance objects.Each historic activity instance object has the following properties:

Name Value Description
id String The id of the variable instance.
name String The name of the variable instance.
type String The value type of the variable.}
Name Value Description
——-
value String/Number/Boolean/Object

NameValueDescription
valueString / Number / Boolean / Object The variable's value. Value differs depending on the variable's type and on the deserializeValues parameter.
typeStringThe value type of the variable.
valueInfoObject A JSON object containing additional, value-type-dependent properties.
For variables of type Object, the following properties are returned:

  • objectTypeName: A string representation of the object's type name.
  • serializationDataFormat: The serialization format used to store the variable.


|value|String / Number / Boolean / Object| The variable's value. Value differs depending on the variable's type and on the deserializeValues parameter.|type|String|The value type of the variable.|valueInfo|Object| A JSON object containing additional, value-type-dependent properties.
For variables of type Object, the following properties are returned:

  • objectTypeName: A string representation of the object's type name.

  • serializationDataFormat: The serialization format used to store the variable.
    |Name|Value|Description
    |——-
    |value|String / Number / Boolean / Object| The variable's value. Value differs depending on the variable's type and on the deserializeValues parameter.
    |type|String|The value type of the variable.
    |valueInfo|Object| A JSON object containing additional, value-type-dependent properties.
    For variables of type Object, the following properties are returned:

  • objectTypeName: A string representation of the object's type name.

  • serializationDataFormat: The serialization format used to store the variable.
    |valueInfo|Object|A JSON object containing additional, value-type-dependent properties.
    For variables of type Object, the following properties are returned:

  • objectTypeName: A string representation of the object's type name.

  • serializationDataFormat: The serialization format used to store the variable.
    |processDefinitionKey|String|The key of the process definition the variable instance belongs to.
    |processDefinitionId|String|The id of the process definition the variable instance belongs to.
    |processInstanceId|String|The id the process instance belongs to.
    |executionId|String|The id of the execution the variable instance belongs to.
    |activityInstanceId|String|The id of the activity instance in which the variable is valid.
    |caseDefinitionKey|String|The key of the case definition the variable instance belongs to.
    |caseDefinitionId|String|The id of the case definition the variable instance belongs to.
    |caseInstanceId|String|The id of the case instance the variable instance belongs to.
    |caseExecutionId|String|The id of the case execution the variable instance belongs to.
    |taskId|String|The id of the task the variable instance belongs to.
    |tenantId|String|The id of the tenant that this variable instance belongs to.
    |state|String|The current state of the variable. Can be 'CREATED' or 'DELETED'.
  • 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/variable-instance

    Request Body:

    1. {
    2. "variableName": "someVariable",
    3. "variableValue": 42,
    4. "sorting":
    5. [{"sortBy": "variableName",
    6. "sortOrder": "asc"
    7. },
    8. {"sortBy": "instanceId",
    9. "sortOrder": "desc"
    10. }]
    11. }

    Response

    1. [
    2. {
    3. "id": "someId",
    4. "name": "someVariable",
    5. "type": "Integer",
    6. "variableType": "integer",
    7. "value": 5,
    8. "valueInfo": {},
    9. "processDefinitionKey": "aProcessDefinitionKey",
    10. "processDefinitionId": "aProcessDefinitionId",
    11. "processInstanceId": "aProcInstId",
    12. "executionId": "aExecutionId",
    13. "activityInstanceId": "aActivityInstId",
    14. "caseDefinitionKey": null,
    15. "caseInstanceId": null,
    16. "caseExecutionId": null,
    17. "taskId": null,
    18. "tenantId": null,
    19. "errorMessage": null
    20. }
    21. ]

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