- 1. 简介
- 2. 开始
- 3. 配置
- 4. Flowable API
- 5. 集成 Spring
- 6. 部署
- 7. BPMN 2.0 介绍
- 8. BPMN 2.0 结构
- 9. 表单
- 10. JPA
- 11. 历史
- 12. 身份管理
- 13. Eclipse Designer
- 14. Flowable UI 应用
- 15. REST API
- 16. 集成 CDI
- 17. 集成 LDAP
- 18. 高级
- 19. 工具
15.5. Process Instances
15.5.1. Get a process instance
GET runtime/process-instances/{processInstanceId}
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to get. |
Response code | Description |
---|---|
200 | Indicates the process instance was found and returned. |
404 | Indicates the requested process instance was not found. |
Success response body:
{
"id":"7",
"url":"http://localhost:8182/runtime/process-instances/7",
"businessKey":"myBusinessKey",
"suspended":false,
"processDefinitionUrl":"http://localhost:8182/repository/process-definitions/processOne%3A1%3A4",
"activityId":"processTask",
"tenantId": null
}
15.5.2. Delete a process instance
DELETE runtime/process-instances/{processInstanceId}
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to delete. |
Response code | Description |
---|---|
204 | Indicates the process instance was found and deleted. Response body is left empty intentionally. |
404 | Indicates the requested process instance was not found. |
15.5.3. Activate or suspend a process instance
PUT runtime/process-instances/{processInstanceId}
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to activate/suspend. |
Request response body (suspend):
{
"action":"suspend"
}
Request response body (activate):
{
"action":"activate"
}
Response code | Description |
---|---|
200 | Indicates the process instance was found and action was executed. |
400 | Indicates an invalid action was supplied. |
404 | Indicates the requested process instance was not found. |
409 | Indicates the requested process instance action cannot be executed since the process-instance is already activated/suspended. |
15.5.4. Start a process instance
POST runtime/process-instances
Request body (start by process definition id):
{
"processDefinitionId":"oneTaskProcess:1:158",
"businessKey":"myBusinessKey",
"returnVariables":true,
"variables": [
{
"name":"myVar",
"value":"This is a variable",
}
]
}
Request body (start by process definition key):
{
"processDefinitionKey":"oneTaskProcess",
"businessKey":"myBusinessKey",
"returnVariables":false,
"tenantId": "tenant1",
"variables": [
{
"name":"myVar",
"value":"This is a variable",
}
]
}
Request body (start by message):
{
"message":"newOrderMessage",
"businessKey":"myBusinessKey",
"tenantId": "tenant1",
"variables": [
{
"name":"myVar",
"value":"This is a variable",
}
]
}
Note that also a transientVariables property is accepted as part of this json, that follows the same structure as the variables property.
The returnVariables property can be used to get the existing variables in the process instance context back in the response. By default the variables are not returned.
Only one of processDefinitionId
, processDefinitionKey
or message
can be used in the request body. Parameters businessKey
, variables
and tenantId
are optional. If tenantId
is omitted, the default tenant will be used. More information about the variable format can be found in the REST variables section. Note that the variable-scope that is supplied is ignored, process-variables are always local
.
Response code | Description |
---|---|
201 | Indicates the process instance was created. |
400 | Indicates either the process-definition was not found (based on id or key), no process is started by sending the given message or an invalid variable has been passed. Status description contains additional information about the error. |
Success response body:
{
"id":"7",
"url":"http://localhost:8182/runtime/process-instances/7",
"businessKey":"myBusinessKey",
"suspended":false,
"processDefinitionUrl":"http://localhost:8182/repository/process-definitions/processOne%3A1%3A4",
"activityId":"processTask",
"tenantId" : null
}
15.5.5. List of process instances
GET runtime/process-instances
Parameter | Required | Value | Description |
---|---|---|---|
id | No | String | Only return process instance with the given id. |
processDefinitionKey | No | String | Only return process instances with the given process definition key. |
processDefinitionId | No | String | Only return process instances with the given process definition id. |
businessKey | No | String | Only return process instances with the given businessKey. |
involvedUser | No | String | Only return process instances in which the given user is involved. |
suspended | No | Boolean | If true , only return process instance which are suspended. If false , only return process instances which are not suspended (active). |
superProcessInstanceId | No | String | Only return process instances which have the given super process-instance id (for processes that have a call-activities). |
subProcessInstanceId | No | String | Only return process instances which have the given sub process-instance id (for processes started as a call-activity). |
excludeSubprocesses | No | Boolean | Return only process instances which aren’t sub processes. |
includeProcessVariables | No | Boolean | Indication to include process variables in the result. |
tenantId | No | String | Only return process instances with the given tenantId. |
tenantIdLike | No | String | Only return process instances with a tenantId like the given value. |
withoutTenantId | No | Boolean | If true , only returns process instances without a tenantId set. If false , the withoutTenantId parameter is ignored. |
sort | No | String | Sort field, should be either one of id (default), processDefinitionId , tenantId or processDefinitionKey . |
Response code | Description |
---|---|
200 | Indicates request was successful and the process-instances are returned |
400 | Indicates a parameter was passed in the wrong format . The status-message contains additional information. |
Success response body:
{
"data":[
{
"id":"7",
"url":"http://localhost:8182/runtime/process-instances/7",
"businessKey":"myBusinessKey",
"suspended":false,
"processDefinitionUrl":"http://localhost:8182/repository/process-definitions/processOne%3A1%3A4",
"activityId":"processTask",
"tenantId" : null
}
],
"total":2,
"start":0,
"sort":"id",
"order":"asc",
"size":2
}
15.5.6. Query process instances
POST query/process-instances
Request body:
{
"processDefinitionKey":"oneTaskProcess",
"variables":
[
{
"name" : "myVariable",
"value" : 1234,
"operation" : "equals",
"type" : "long"
}
]
}
The request body can contain all possible filters that can be used in the List process instances URL query. On top of these, it’s possible to provide an array of variables to include in the query, with their format described here.
The general paging and sorting query-parameters can be used for this URL.
Response code | Description |
---|---|
200 | Indicates request was successful and the process-instances are returned |
400 | Indicates a parameter was passed in the wrong format . The status-message contains additional information. |
Success response body:
{
"data":[
{
"id":"7",
"url":"http://localhost:8182/runtime/process-instances/7",
"businessKey":"myBusinessKey",
"suspended":false,
"processDefinitionUrl":"http://localhost:8182/repository/process-definitions/processOne%3A1%3A4",
"activityId":"processTask",
"tenantId" : null
}
],
"total":2,
"start":0,
"sort":"id",
"order":"asc",
"size":2
}
15.5.7. Get diagram for a process instance
GET runtime/process-instances/{processInstanceId}/diagram
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to get the diagram for. |
Response code | Description |
---|---|
200 | Indicates the process instance was found and the diagram was returned. |
400 | Indicates the requested process instance was not found but the process doesn’t contain any graphical information (BPMN:DI) and no diagram can be created. |
404 | Indicates the requested process instance was not found. |
Success response body:
{
"id":"7",
"url":"http://localhost:8182/runtime/process-instances/7",
"businessKey":"myBusinessKey",
"suspended":false,
"processDefinitionUrl":"http://localhost:8182/repository/process-definitions/processOne%3A1%3A4",
"activityId":"processTask"
}
15.5.8. Get involved people for process instance
GET runtime/process-instances/{processInstanceId}/identitylinks
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to the links for. |
Response code | Description |
---|---|
200 | Indicates the process instance was found and links are returned. |
404 | Indicates the requested process instance was not found. |
Success response body:
[
{
"url":"http://localhost:8182/runtime/process-instances/5/identitylinks/users/john/customType",
"user":"john",
"group":null,
"type":"customType"
},
{
"url":"http://localhost:8182/runtime/process-instances/5/identitylinks/users/paul/candidate",
"user":"paul",
"group":null,
"type":"candidate"
}
]
Note that the groupId
will always be null, as it’s only possible to involve users with a process-instance.
15.5.9. Add an involved user to a process instance
POST runtime/process-instances/{processInstanceId}/identitylinks
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to the links for. |
Request body:
{
"userId":"kermit",
"type":"participant"
}
Both userId
and type
are required.
Response code | Description |
---|---|
201 | Indicates the process instance was found and the link is created. |
400 | Indicates the requested body did not contain a userId or a type. |
404 | Indicates the requested process instance was not found. |
Success response body:
{
"url":"http://localhost:8182/runtime/process-instances/5/identitylinks/users/john/customType",
"user":"john",
"group":null,
"type":"customType"
}
Note that the groupId
will always be null, as it’s only possible to involve users with a process-instance.
15.5.10. Remove an involved user to from process instance
DELETE runtime/process-instances/{processInstanceId}/identitylinks/users/{userId}/{type}
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance. |
userId | Yes | String | The id of the user to delete link for. |
type | Yes | String | Type of link to delete. |
Response code | Description |
---|---|
204 | Indicates the process instance was found and the link has been deleted. Response body is left empty intentionally. |
404 | Indicates the requested process instance was not found or the link to delete doesn’t exist. The response status contains additional information about the error. |
Success response body:
{
"url":"http://localhost:8182/runtime/process-instances/5/identitylinks/users/john/customType",
"user":"john",
"group":null,
"type":"customType"
}
Note that the groupId
will always be null, as it’s only possible to involve users with a process-instance.
15.5.11. List of variables for a process instance
GET runtime/process-instances/{processInstanceId}/variables
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to the variables for. |
Response code | Description |
---|---|
200 | Indicates the process instance was found and variables are returned. |
404 | Indicates the requested process instance was not found. |
Success response body:
[
{
"name":"intProcVar",
"type":"integer",
"value":123,
"scope":"local"
},
{
"name":"byteArrayProcVar",
"type":"binary",
"value":null,
"valueUrl":"http://localhost:8182/runtime/process-instances/5/variables/byteArrayProcVar/data",
"scope":"local"
}
]
In case the variable is a binary variable or serializable, the valueUrl
points to an URL to fetch the raw value. If it’s a plain variable, the value is present in the response. Note that only local
scoped variables are returned, as there is no global
scope for process-instance variables.
15.5.12. Get a variable for a process instance
GET runtime/process-instances/{processInstanceId}/variables/{variableName}
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to the variables for. |
variableName | Yes | String | Name of the variable to get. |
Response code | Description |
---|---|
200 | Indicates both the process instance and variable were found and variable is returned. |
400 | Indicates the request body is incomplete or contains illegal values. The status description contains additional information about the error. |
404 | Indicates the requested process instance was not found or the process instance does not have a variable with the given name. Status description contains additional information about the error. |
Success response body:
{
"name":"intProcVar",
"type":"integer",
"value":123,
"scope":"local"
}
In case the variable is a binary variable or serializable, the valueUrl
points to an URL to fetch the raw value. If it’s a plain variable, the value is present in the response. Note that only local
scoped variables are returned, as there is no global
scope for process-instance variables.
15.5.13. Create (or update) variables on a process instance
POST runtime/process-instances/{processInstanceId}/variables
PUT runtime/process-instances/{processInstanceId}/variables
When using POST
, all variables that are passed are created. In case one of the variables already exists on the process instance, the request results in an error (409 - CONFLICT). When PUT
is used, nonexistent variables are created on the process-instance and existing ones are overridden without any error.
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to the variables for. |
Request body:
[ { "name":"intProcVar" "type":"integer" "value":123 }, ... ]
Any number of variables can be passed into the request body array. More information about the variable format can be found in the REST variables section. Note that scope is ignored, only local
variables can be set in a process instance.
Response code | Description |
---|---|
201 | Indicates the process instance was found and variable is created. |
400 | Indicates the request body is incomplete or contains illegal values. The status description contains additional information about the error. |
404 | Indicates the requested process instance was not found. |
409 | Indicates the process instance was found but already contains a variable with the given name (only thrown when POST method is used). Use the update-method instead. |
Success response body:
[ { "name":"intProcVar", "type":"integer", "value":123, "scope":"local" }, ... ]
15.5.14. Update a single variable on a process instance
PUT runtime/process-instances/{processInstanceId}/variables/{variableName}
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to the variables for. |
variableName | Yes | String | Name of the variable to get. |
Request body:
{
"name":"intProcVar"
"type":"integer"
"value":123
}
More information about the variable format can be found in the REST variables section. Note that scope is ignored, only local
variables can be set in a process instance.
Response code | Description |
---|---|
200 | Indicates both the process instance and variable were found and variable is updated. |
404 | Indicates the requested process instance was not found or the process instance does not have a variable with the given name. Status description contains additional information about the error. |
Success response body:
{
"name":"intProcVar",
"type":"integer",
"value":123,
"scope":"local"
}
In case the variable is a binary variable or serializable, the valueUrl
points to an URL to fetch the raw value. If it’s a plain variable, the value is present in the response. Note that only local
scoped variables are returned, as there is no global
scope for process-instance variables.
15.5.15. Create a new binary variable on a process-instance
POST runtime/process-instances/{processInstanceId}/variables
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to create the new variable for. |
Request body:
The request should be of type multipart/form-data
. There should be a single file-part included with the binary value of the variable. On top of that, the following additional form-fields can be present:
name
: Required name of the variable.type
: Type of variable that is created. If omitted,binary
is assumed and the binary data in the request will be stored as an array of bytes.
Success response body:
{
"name" : "binaryVariable",
"scope" : "local",
"type" : "binary",
"value" : null,
"valueUrl" : "http://.../runtime/process-instances/123/variables/binaryVariable/data"
}
Response code | Description |
---|---|
201 | Indicates the variable was created and the result is returned. |
400 | Indicates the name of the variable to create was missing. Status message provides additional information. |
404 | Indicates the requested process instance was not found. |
409 | Indicates the process instance already has a variable with the given name. Use the PUT method to update the task variable instead. |
415 | Indicates the serializable data contains an object for which no class is present in the JVM running the Flowable engine and therefore cannot be deserialized. |
15.5.16. Update an existing binary variable on a process-instance
PUT runtime/process-instances/{processInstanceId}/variables
Parameter | Required | Value | Description |
---|---|---|---|
processInstanceId | Yes | String | The id of the process instance to create the new variable for. |
Request body: The request should be of type multipart/form-data
. There should be a single file-part included with the binary value of the variable. On top of that, the following additional form-fields can be present:
name
: Required name of the variable.type
: Type of variable that is created. If omitted,binary
is assumed and the binary data in the request will be stored as an array of bytes.
Success response body:
{
"name" : "binaryVariable",
"scope" : "local",
"type" : "binary",
"value" : null,
"valueUrl" : "http://.../runtime/process-instances/123/variables/binaryVariable/data"
}
Response code | Description |
---|---|
200 | Indicates the variable was updated and the result is returned. |
400 | Indicates the name of the variable to update was missing. Status message provides additional information. |
404 | Indicates the requested process instance was not found or the process instance does not have a variable with the given name. |
415 | Indicates the serializable data contains an object for which no class is present in the JVM running the Flowable engine and therefore cannot be deserialized. |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论