Executes a modification synchronously for multiple process instances.To modify a single process instance, use the Modify Process Instance Execution State method.To execute a modification asynchronously, use the Execute Modification Async (Batch) method.

For more information about the difference between synchronous andasynchronous execution of a modification, please refer to the relatedsection of the user guide.

Method

POST /modification/execute

Parameters

Request Body

A JSON object with the following properties:

Name Description
processDefinitionId The id of the process definition for the modification
skipCustomListeners Skip execution listener invocation for activities that are started or ended as part of this request.
skipIoMappings Skip execution of input/output variable mappings for activities that are started or ended as part of this request.
processInstanceIds A list of process instance ids to modify.
processInstanceQuery A process instance query like the request body described by POST /process-instance .
instructions A JSON array of modification instructions. The instructions are executed in the order they are in. An instruction may have the following properties:

typeMandatory. One of the following values: cancel, startBeforeActivity, startAfterActivity, startTransition. A startBeforeActivity and cancel instructions request to enter a given activity. A startAfterActivity instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition instruction requests to execute a specific sequence flow.
activityIdCan be used with instructions of types startBeforeActivity, startAfterActivity, and cancel. Specifies the activity the instruction targets.
transitionIdCan be used with instructions of type startTransition. Specifies the sequence flow to start.
cancelCurrentActiveActivityInstancesCan be used with instructions of type cancel. Prevents the deletion of new created activity instances.

|type|Mandatory. One of the following values: cancel, startBeforeActivity, startAfterActivity, startTransition. A startBeforeActivity and cancel instructions request to enter a given activity. A startAfterActivity instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition instruction requests to execute a specific sequence flow.|activityId|Can be used with instructions of types startBeforeActivity, startAfterActivity, and cancel. Specifies the activity the instruction targets.|transitionId|Can be used with instructions of type startTransition. Specifies the sequence flow to start.|cancelCurrentActiveActivityInstances|Can be used with instructions of type cancel. Prevents the deletion of new created activity instances.
|type|Mandatory. One of the following values: cancel, startBeforeActivity, startAfterActivity, startTransition. A startBeforeActivity and cancel instructions request to enter a given activity. A startAfterActivity instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition instruction requests to execute a specific sequence flow.
|activityId|Can be used with instructions of types startBeforeActivity, startAfterActivity, and cancel. Specifies the activity the instruction targets.
|transitionId|Can be used with instructions of type startTransition. Specifies the sequence flow to start.
|cancelCurrentActiveActivityInstances|Can be used with instructions of type cancel. Prevents the deletion of new created activity instances.

Result

This method returns no content.

Response codes

Code Media type Description
204 Request successful.
400 application/json In case following parameters are missing: instructions, processDefinitionId, activityId or transitionId, processInstanceIds or processInstanceQuery, an exception of type InvalidRequestException is returned. See the Introduction for the error response format.

Example

Request

POST /modification/execute

Request Body:

  1. {
  2. "processDefinitionId" : "aProcessDefinitionId",
  3. "instructions": [
  4. {
  5. "type": "startAfterActivity",
  6. "activityId": "aUserTask"
  7. },
  8. {
  9. "type": "cancel",
  10. "activityId": "anotherTask",
  11. "cancelCurrentActiveActivityInstances" : true
  12. }
  13. ],
  14. "processInstanceIds": [
  15. "aProcessInstance",
  16. "anotherProcessInstance"
  17. ],
  18. "processInstanceQuery": {
  19. "processDefinitionId": "aProcessDefinitionId"
  20. },
  21. "skipCustomListeners": true
  22. }

Response

Status 204. No content.

原文: https://docs.camunda.org/manual/7.9/reference/rest/modification/post-modification-sync/