Post Process Variable (Binary)

Sets the serialized value for a binary variable or the binary value for a file variable.

Method

POST /process-instance/{id}/variables/{varName}/data

Parameters

Path Parameters

Name Description
id The id of the process instance to set the variable for.
varName The name of the variable to set.

Request Body

For binary variables a multipart form submit with the following parts:

Form Part Name Content Type Description
data application/octet-stream

The binary data to be set.

For File variables, this multipart can contain the filename, binary value and MIME type of the file variable to be set. Only the filename is mandatory.

valueType text/plain The name of the variable type. Either Bytes for a byte array variable or File for a file variable.
data application/json Deprecated: This only works if the REST API is aware of the involved Java classes.

A JSON representation of a serialized Java Object. Form part type (see below) must be provided.

type text/plain Deprecated: This only works if the REST API is aware of the involved Java classes.

The canonical java type name of the process variable to be set. Example: foo.bar.Customer. If this part is provided, data must be a JSON object which can be converted into an instance of the provided class. The content type of the data part must be application/json in that case (see above).

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 no filename is set. See the Introduction for the error response format.

Example

Request

(1) Post binary content of a byte array variable:

POST /process-instance/aProcessInstanceId/variables/aVarName/data

Request Body:

---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y
Content-Disposition: form-data; name="data"; filename="unspecified"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

<<Byte Stream ommitted>>
---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y
Content-Disposition: form-data; name="valueType"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit

Bytes
---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y--

(2) Post the JSON serialization of a Java Class (deprecated):

POST /process-instance/aProcessInstanceId/variables/aVarName/data

Request Body:

---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y
Content-Disposition: form-data; name="data"
Content-Type: application/json; charset=US-ASCII
Content-Transfer-Encoding: 8bit

["foo", "bar"]
---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y
Content-Disposition: form-data; name="type"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit

java.util.ArrayList<java.lang.Object>
---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y--

(3) Post a text file:

POST /process-instance/aProcessInstanceId/variables/aVarName/data

Request Body:

---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y
Content-Disposition: form-data; name="data"; filename="myFile.txt"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: binary

<<Byte Stream ommitted>>
---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y
Content-Disposition: form-data; name="valueType"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit

File
---OSQH1f8lzs83iXFHphqfIuitaQfNKFY74Y--

Response

Status 204. No content.

On this Page: