Set Variables Async (POST)

Update or create runtime process variables in the root scope of process instances.

Method

POST /process-instance/variables-async

Parameters

Request Body

A JSON object with the following properties:

Name Description
processInstanceIds A list of process instance ids that define a group of process instances to which the operation will set variables.
processInstanceQuery A process instance query like the request body for the Get Instances (POST) method to select process instances the operation will set variables to.
historicProcessInstanceQuery A historic process instance query like the request body for the Get Instances (POST) method to select process instances the operation will set variables to.
variables A JSON object containing variable key-value pairs the operation will set in the root scope of the process instances. Each key is a variable name and each value a JSON variable value object.

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 type File, 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.

Please note that if processInstanceIds, processInstanceQuery and historicProcessInstanceQuery are defined, the resulting operation will be performed on the union of these sets.

Response Body

A JSON object corresponding to the Batch interface in the engine. Its properties are as follows:

Name Value Description
id String The id of the batch.
type String The type of the batch. See the User Guide for more information about batch types.
totalJobs Number The total jobs of a batch is the number of batch execution jobs required to complete the batch.
jobsCreated Number The number of batch execution jobs already created by the seed job.
batchJobsPerSeed Number The number of batch execution jobs created per seed job invocation. The batch seed job is invoked until it has created all batch execution jobs required by the batch (see totalJobs property).
invocationsPerBatchJob Number Every batch execution job invokes the command executed by the batch invocationsPerBatchJob times. E.g., for a process instance migration batch this specifies the number of process instances which are migrated per batch execution job.
seedJobDefinitionId String The job definition id for the seed jobs of this batch.
monitorJobDefinitionId String The job definition id for the monitor jobs of this batch.
batchJobDefinitionId String The job definition id for the batch execution jobs of this batch.
suspended Boolean Indicates whether this batch is suspended or not.
tenantId String The tenant id of the batch.
createUserId String The id of the user that created the batch.

Response Codes

Code Media type Description
200 application/json 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
  • If none of processInstanceIds, processInstanceQuery and historicProcessInstanceQuery is given
  • If no or an empty array of variables is given
  • If no process instance ids where found
  • If a transient variable is set
  • If the engine config flag javaSerializationFormatEnabled is false and a Java serialized variable is given
See the Introduction for the error response format.

Example

Request

POST /process-instance/variables-async

Request Body:

{
  "processInstanceIds" : [
    "b4d2ad98-7240-11e9-98b7-be5e0f7575b7"
  ],
  "processInstanceQuery": {
    "processDefinitionKey": "my-process-definition-key"
  },
  "variables" : {
    "myVariableName": {
      "value": "myStringValue"
    }
  }
}

Response

Status 200 OK

{
  "id": "120b568d-724a-11e9-98b7-be5e0f7575b7",
  "type": "set-variables",
  "totalJobs": 12,
  "batchJobsPerSeed": 100,
  "invocationsPerBatchJob": 1,
  "seedJobDefinitionId": "120b5690-724a-11e9-98b7-be5e0f7575b7",
  "monitorJobDefinitionId": "120b568f-724a-11e9-98b7-be5e0f7575b7",
  "batchJobDefinitionId": "120b568e-724a-11e9-98b7-be5e0f7575b7",
  "tenantId": "accounting",
  "suspended": false,
  "createUserId": null
}

目录: