Retrieves a variable by id.

Method

GET /variable-instance/{id}

Parameters

Path Parameters

Name Description
id The id of the variable instance.

Query Parameters

Name Description
deserializeValue 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.

Result

A JSON object with 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 deserializeValue 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 deserializeValue 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 deserializeValue 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.
    |processInstanceId|String|The id of the process instance that this variable instance belongs to.
    |executionId|String|The id of the execution that this variable instance belongs to.
    |caseInstanceId|String|The id of the case instance that this variable instance belongs to.
    |caseExecutionId|String|The id of the case execution that this variable instance belongs to.
    |taskId|String|The id of the task that this variable instance belongs to.
    |activityInstanceId|String|The id of the activity instance that this variable instance belongs to.
    |tenantId|String|The id of the tenant that this variable instance belongs to.
    |errorMessage|String|An error message in case a Java Serialized Object could not be de-serialized.
  • Response Codes

    Code Media type Description
    200 application/json Request successful.
    404 application/json Variable with given id does not exist. See the Introduction for the error response format.

    Example

    Request

    GET /variable-instance/someId

    Response

    Status 200.

    1. {
    2. "id": "someId",
    3. "name": "amount",
    4. "type": "Integer",
    5. "variableType": "integer",
    6. "value": 5,
    7. "processInstanceId": "aProcessInstanceId",
    8. "executionId": "b68b71c9-e310-11e2-beb0-f0def1557726",
    9. "taskId": null,
    10. "activityInstanceId": "Task_1:b68b71ca-e310-11e2-beb0-f0def1557726",
    11. "caseExecutionId": null,
    12. "caseInstanceId": null,
    13. "tenantId": null,
    14. "errorMessage": null
    15. }

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