Sets a variable of a given case instance by id.
Method
PUT /case-instance/{id}/variables/{varName}
Parameters
Path Parameters
Name | Description |
---|---|
id | The id of the case instance to set the variable for. |
varName | The name of the variable to set. |
Request Body
A JSON object with the following properties:
Name | Description |
---|---|
value | The variable's value. For variables of type Object , the serialized value has to be submitted as a String value. |
For variables of type File
the value has to be submitted as Base64 encoded string.
|type|The value type of the variable.
|valueInfo| A JSON object containing additional, value-type-dependent properties.
For serialized variables of type Object
, the following properties can be provided:
- objectTypeName: A string representation of the object's type name.
serializationDataFormat: The serialization format used to store the variable.
For serialized variables of typeFile
, the following properties can be provided:filename: The name of the file. This is not the variable name but the name that will be used when downloading the file again.
- mimetype: The MIME type of the file that is being uploaded.
encoding: The encoding of the file that is being uploaded.
The following property can be provided for all value types:transient: Indicates whether the variable should be transient or not. See documentation for more informations.
Result
This method returns no content.
Response Codes
Code | Media type | Description |
---|---|---|
204 | Request successful. | |
400 | application/json | The variable value or type is invalid, for example if the value could not be parsed to an Integer value or the passed variable type is not supported. See the Introduction for the error response format. |
Example 1
Request
PUT /case-instance/aCaseInstanceId/variables/aVarName
{"value" : "someValue", "type": "String"}
Response
Status 204. No content.
Example 2
Request
PUT /case-instance/aCaseInstanceId/variables/aVarName
{
"value" : "
", a b "type" : "Object",
"valueInfo" : {
"objectTypeName": "com.example.MyObject",
"serializationDataFormat": "application/xml"
}
}
Response
Status 204. No content.
原文: https://docs.camunda.org/manual/7.9/reference/rest/case-instance/variables/put-variable/