Variables in the REST API
In the REST API, process variables are represented by JSON objects of the following form:
{
"type": "String",
"value": "Some value",
"valueInfo": {}
}
The REST API supports the Value Types supported by the process engine.
Capitalization of Type Names​
In the REST API, the type names start with a capital letter, i.e., String instead of string.
Serialized and Deserialized Object Values​
Object Values are instances of (non primitive) Java types. When working with the REST API, it is generally advisable to work with the serialized value of a variable. In that case the value is retrieved from the database and directly returned in the http response. If the client you are building is not a Java Applications by itself, make sure you use a text-based serialization dataformat (such as XML or JSON).
To retrieve the serialized form of a variable, use the deserializeValues=false GET parameter.
Serialize Variables of type Object in REST API​
In the REST API, process variables of type Object can be serialized in JSON or XML format.
Serializing Object into JSON format:
{
"variables": {
"aVariable": {
"value": "{\"somekey\": \"somevalue\"}",
"type": "Object",
"valueInfo": {
"objectTypeName": "com.operaton.SomeClass",
"serializationDataFormat": "application/json"
}
}
}
}
Serializing Object into XML format:
{
"variables": {
"aVariable": {
"value": "<somekey>somevalue</somekey>",
"type": "Object",
"valueInfo": {
"objectTypeName": "com.operaton.SomeClass",
"serializationDataFormat": "application/xml"
}
}
}
}