Modify Process Instance Execution State
curl --request POST \
--url http://{host}:{port}/{contextPath}/process-instance/{id}/modification \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"skipCustomListeners": true,
"skipIoMappings": true,
"instructions": [
{
"type": "startBeforeActivity",
"activityId": "activityId",
"variables": {
"var": {
"value": "aVariableValue",
"local": false,
"type": "String"
},
"varLocal": {
"value": "anotherVariableValue",
"local": true,
"type": "String"
}
}
},
{
"type": "cancel",
"activityInstanceId": "anActivityInstanceId"
}
],
"annotation": "Modified to resolve an error."
}
'import requests
url = "http://{host}:{port}/{contextPath}/process-instance/{id}/modification"
payload = {
"skipCustomListeners": True,
"skipIoMappings": True,
"instructions": [
{
"type": "startBeforeActivity",
"activityId": "activityId",
"variables": {
"var": {
"value": "aVariableValue",
"local": False,
"type": "String"
},
"varLocal": {
"value": "anotherVariableValue",
"local": True,
"type": "String"
}
}
},
{
"type": "cancel",
"activityInstanceId": "anActivityInstanceId"
}
],
"annotation": "Modified to resolve an error."
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
skipCustomListeners: true,
skipIoMappings: true,
instructions: [
{
type: 'startBeforeActivity',
activityId: 'activityId',
variables: {
var: {value: 'aVariableValue', local: false, type: 'String'},
varLocal: {value: 'anotherVariableValue', local: true, type: 'String'}
}
},
{type: 'cancel', activityInstanceId: 'anActivityInstanceId'}
],
annotation: 'Modified to resolve an error.'
})
};
fetch('http://{host}:{port}/{contextPath}/process-instance/{id}/modification', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{host}:{port}/{contextPath}/process-instance/{id}/modification",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'skipCustomListeners' => true,
'skipIoMappings' => true,
'instructions' => [
[
'type' => 'startBeforeActivity',
'activityId' => 'activityId',
'variables' => [
'var' => [
'value' => 'aVariableValue',
'local' => false,
'type' => 'String'
],
'varLocal' => [
'value' => 'anotherVariableValue',
'local' => true,
'type' => 'String'
]
]
],
[
'type' => 'cancel',
'activityInstanceId' => 'anActivityInstanceId'
]
],
'annotation' => 'Modified to resolve an error.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://{host}:{port}/{contextPath}/process-instance/{id}/modification"
payload := strings.NewReader("{\n \"skipCustomListeners\": true,\n \"skipIoMappings\": true,\n \"instructions\": [\n {\n \"type\": \"startBeforeActivity\",\n \"activityId\": \"activityId\",\n \"variables\": {\n \"var\": {\n \"value\": \"aVariableValue\",\n \"local\": false,\n \"type\": \"String\"\n },\n \"varLocal\": {\n \"value\": \"anotherVariableValue\",\n \"local\": true,\n \"type\": \"String\"\n }\n }\n },\n {\n \"type\": \"cancel\",\n \"activityInstanceId\": \"anActivityInstanceId\"\n }\n ],\n \"annotation\": \"Modified to resolve an error.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://{host}:{port}/{contextPath}/process-instance/{id}/modification")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"skipCustomListeners\": true,\n \"skipIoMappings\": true,\n \"instructions\": [\n {\n \"type\": \"startBeforeActivity\",\n \"activityId\": \"activityId\",\n \"variables\": {\n \"var\": {\n \"value\": \"aVariableValue\",\n \"local\": false,\n \"type\": \"String\"\n },\n \"varLocal\": {\n \"value\": \"anotherVariableValue\",\n \"local\": true,\n \"type\": \"String\"\n }\n }\n },\n {\n \"type\": \"cancel\",\n \"activityInstanceId\": \"anActivityInstanceId\"\n }\n ],\n \"annotation\": \"Modified to resolve an error.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{host}:{port}/{contextPath}/process-instance/{id}/modification")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"skipCustomListeners\": true,\n \"skipIoMappings\": true,\n \"instructions\": [\n {\n \"type\": \"startBeforeActivity\",\n \"activityId\": \"activityId\",\n \"variables\": {\n \"var\": {\n \"value\": \"aVariableValue\",\n \"local\": false,\n \"type\": \"String\"\n },\n \"varLocal\": {\n \"value\": \"anotherVariableValue\",\n \"local\": true,\n \"type\": \"String\"\n }\n }\n },\n {\n \"type\": \"cancel\",\n \"activityInstanceId\": \"anActivityInstanceId\"\n }\n ],\n \"annotation\": \"Modified to resolve an error.\"\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"message": "<string>",
"code": 123
}{
"type": "<string>",
"message": "<string>",
"code": 123
}流程实例
修改流程实例执行状态
Submits a list of modification instructions to change a process instance’s execution state. A modification instruction is one of the following:
- Starting execution before an activity
- Starting execution after an activity on its single outgoing sequence flow
- Starting execution on a specific sequence flow
- Canceling an activity instance, transition instance, or all instances (activity or transition) for an activity
Instructions are executed immediately and in the order they are provided in this request’s body. Variables can be provided with every starting instruction.
The exact semantics of modification can be read about in the User guide.
POST
/
process-instance
/
{id}
/
modification
Modify Process Instance Execution State
curl --request POST \
--url http://{host}:{port}/{contextPath}/process-instance/{id}/modification \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"skipCustomListeners": true,
"skipIoMappings": true,
"instructions": [
{
"type": "startBeforeActivity",
"activityId": "activityId",
"variables": {
"var": {
"value": "aVariableValue",
"local": false,
"type": "String"
},
"varLocal": {
"value": "anotherVariableValue",
"local": true,
"type": "String"
}
}
},
{
"type": "cancel",
"activityInstanceId": "anActivityInstanceId"
}
],
"annotation": "Modified to resolve an error."
}
'import requests
url = "http://{host}:{port}/{contextPath}/process-instance/{id}/modification"
payload = {
"skipCustomListeners": True,
"skipIoMappings": True,
"instructions": [
{
"type": "startBeforeActivity",
"activityId": "activityId",
"variables": {
"var": {
"value": "aVariableValue",
"local": False,
"type": "String"
},
"varLocal": {
"value": "anotherVariableValue",
"local": True,
"type": "String"
}
}
},
{
"type": "cancel",
"activityInstanceId": "anActivityInstanceId"
}
],
"annotation": "Modified to resolve an error."
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
skipCustomListeners: true,
skipIoMappings: true,
instructions: [
{
type: 'startBeforeActivity',
activityId: 'activityId',
variables: {
var: {value: 'aVariableValue', local: false, type: 'String'},
varLocal: {value: 'anotherVariableValue', local: true, type: 'String'}
}
},
{type: 'cancel', activityInstanceId: 'anActivityInstanceId'}
],
annotation: 'Modified to resolve an error.'
})
};
fetch('http://{host}:{port}/{contextPath}/process-instance/{id}/modification', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{host}:{port}/{contextPath}/process-instance/{id}/modification",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'skipCustomListeners' => true,
'skipIoMappings' => true,
'instructions' => [
[
'type' => 'startBeforeActivity',
'activityId' => 'activityId',
'variables' => [
'var' => [
'value' => 'aVariableValue',
'local' => false,
'type' => 'String'
],
'varLocal' => [
'value' => 'anotherVariableValue',
'local' => true,
'type' => 'String'
]
]
],
[
'type' => 'cancel',
'activityInstanceId' => 'anActivityInstanceId'
]
],
'annotation' => 'Modified to resolve an error.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://{host}:{port}/{contextPath}/process-instance/{id}/modification"
payload := strings.NewReader("{\n \"skipCustomListeners\": true,\n \"skipIoMappings\": true,\n \"instructions\": [\n {\n \"type\": \"startBeforeActivity\",\n \"activityId\": \"activityId\",\n \"variables\": {\n \"var\": {\n \"value\": \"aVariableValue\",\n \"local\": false,\n \"type\": \"String\"\n },\n \"varLocal\": {\n \"value\": \"anotherVariableValue\",\n \"local\": true,\n \"type\": \"String\"\n }\n }\n },\n {\n \"type\": \"cancel\",\n \"activityInstanceId\": \"anActivityInstanceId\"\n }\n ],\n \"annotation\": \"Modified to resolve an error.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://{host}:{port}/{contextPath}/process-instance/{id}/modification")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"skipCustomListeners\": true,\n \"skipIoMappings\": true,\n \"instructions\": [\n {\n \"type\": \"startBeforeActivity\",\n \"activityId\": \"activityId\",\n \"variables\": {\n \"var\": {\n \"value\": \"aVariableValue\",\n \"local\": false,\n \"type\": \"String\"\n },\n \"varLocal\": {\n \"value\": \"anotherVariableValue\",\n \"local\": true,\n \"type\": \"String\"\n }\n }\n },\n {\n \"type\": \"cancel\",\n \"activityInstanceId\": \"anActivityInstanceId\"\n }\n ],\n \"annotation\": \"Modified to resolve an error.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{host}:{port}/{contextPath}/process-instance/{id}/modification")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"skipCustomListeners\": true,\n \"skipIoMappings\": true,\n \"instructions\": [\n {\n \"type\": \"startBeforeActivity\",\n \"activityId\": \"activityId\",\n \"variables\": {\n \"var\": {\n \"value\": \"aVariableValue\",\n \"local\": false,\n \"type\": \"String\"\n },\n \"varLocal\": {\n \"value\": \"anotherVariableValue\",\n \"local\": true,\n \"type\": \"String\"\n }\n }\n },\n {\n \"type\": \"cancel\",\n \"activityInstanceId\": \"anActivityInstanceId\"\n }\n ],\n \"annotation\": \"Modified to resolve an error.\"\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"message": "<string>",
"code": 123
}{
"type": "<string>",
"message": "<string>",
"code": 123
}Authorizations
Body
application/json
Skip execution of input/output variable mappings for activities that are started or ended as part of this request.
Response
Request successful.