activiti服务API文档
官方文档地址:
http://www.mossle.com/docs/activiti/index.html#N16608
1.绘制流程图的UI界面
GET http://192.168.1.2:8083/activiti-explorer/
2.上传bpmn文件至activiti-rest
POST http://192.168.1.2:8083/activiti-rest/service/repository/deployments
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA==","Content-Type":"multipart/form-data"}
body
{"file":"上传文件名"}
response
{
"id": "40",
"name": "test2.bpmn20.xml",
"deploymentTime": "2019-06-19T05:49:23.481Z",
"category": null,
"url": "http://192.168.1.2:8083/activiti-rest/service/repository/deployments/40",
"tenantId": ""
}
3. 获取上传模型信息表
GET http://192.168.1.2:8083/activiti-rest/service/repository/deployments?start={start=0}&size={size=10}&sort={sort=id}&order={order=asc}
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
response
{
"data": [
{
"id": "20",
"name": "Demo processes",
"deploymentTime": "2019-06-19T03:20:05.845Z",
"category": null,
"url": "http://192.168.1.2:8083/activiti-rest/service/repository/deployments/20",
"tenantId": ""
},
{
"id": "40",
"name": "test2.bpmn20.xml",
"deploymentTime": "2019-06-19T05:49:23.481Z",
"category": null,
"url": "http://192.168.1.2:8083/activiti-rest/service/repository/deployments/40",
"tenantId": ""
}
],
"total": 2,
"start": 0,
"sort": "id",
"order": "asc",
"size": 2
}
4.创建用户
POST http://192.168.1.2:8083/activiti-rest/service/identity/users
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
body
{
"id":"test",
"firstName":"test",
"lastName":"test",
"email":"",
"password":"test"
}
response
{
"id": "test",
"firstName": "test",
"lastName": "test",
"url": "http://192.168.1.2:8083/activiti-rest/service/identity/users/test",
"email": "",
"pictureUrl": null,
"password": "test"
}
5.获取用户列表
GET http://192.168.1.2:8083/activiti-rest/service/identity/users
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
response
{
"data":[
{
"id":"fozzie",
"firstName":"Fozzie",
"lastName":"Bear",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/users/fozzie",
"email":"[email protected]",
"pictureUrl":null
},
{
"id":"gonzo",
"firstName":"Gonzo",
"lastName":"The Great",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/users/gonzo",
"email":"[email protected]",
"pictureUrl":null
},
{
"id":"kermit",
"firstName":"Kermit",
"lastName":"The Frog",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/users/kermit",
"email":"[email protected]",
"pictureUrl":null
},
{
"id":"test",
"firstName":"test",
"lastName":"test",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/users/test",
"email":"",
"pictureUrl":null
}
],
"total":4,
"start":0,
"sort":"id",
"order":"asc",
"size":4
}
6.获取群组
GET http://192.168.1.2:8083/activiti-rest/service/identity/groups/
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
response
{
"data":[
{
"id":"admin",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/groups/admin",
"name":"Admin",
"type":"security-role"
},
{
"id":"engineering",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/groups/engineering",
"name":"Engineering",
"type":"assignment"
},
{
"id":"management",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/groups/management",
"name":"Management",
"type":"assignment"
},
{
"id":"marketing",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/groups/marketing",
"name":"Marketing",
"type":"assignment"
},
{
"id":"sales",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/groups/sales",
"name":"Sales",
"type":"assignment"
},
{
"id":"user",
"url":"http://192.168.1.2:8083/activiti-rest/service/identity/groups/user",
"name":"User",
"type":"security-role"
}
],
"total":6,
"start":0,
"sort":"id",
"order":"asc",
"size":6
}
7.创建群组
POST http://192.168.1.2:8083/activiti-rest/service/identity/groups
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
body
{
"id":"testgroup",
"name":"Test group",
"type":"Test type"
}
response
{
"id": "testgroup",
"url": "http://192.168.1.2:8083/activiti-rest/service/identity/groups/testgroup",
"name": "Test group",
"type": "Test type"
}
8.为群组添加成员
POST http://192.168.1.2:8083/activiti-rest/service/identity/groups/{groupId}/members
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
body
{
"userId":"test"
}
response
{
"userId": "test",
"url": "http://192.168.1.2:8083/activiti-rest/service/identity/groups/testgroup/members/test",
"groupId": "testgroup"
}
9.获取流程定义
GET http://192.168.1.2:8083/activiti-rest/service/repository/process-definitions/{processDefinitionId}
或者 http://192.168.1.2:8083/activiti-rest/service/repository/process-definitions
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
response
{
"data":[
{
"id":"test2:1:43",
"url":"http://192.168.1.2:8083/activiti-rest/service/repository/process-definitions/test2:1:43",
"key":"test2",
"version":1,
"name":null,
"description":null,
"tenantId":"",
"deploymentId":"40",
"deploymentUrl":"http://192.168.1.2:8083/activiti-rest/service/repository/deployments/40",
"resource":"http://192.168.1.2:8083/activiti-rest/service/repository/deployments/40/resources/test2.bpmn20.xml",
"diagramResource":"http://192.168.1.2:8083/activiti-rest/service/repository/deployments/40/resources/test2.test2.png",
"category":"http://www.activiti.org/processdef",
"graphicalNotationDefined":true,
"suspended":false,
"startFormDefined":false
},
...............................
],
"total":7,
"start":0,
"sort":"name",
"order":"asc",
"size":7
}
10.启动流程
POST http://192.168.1.2:8083/activiti-rest/service/runtime/process-instances
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
body
{
"processDefinitionId":"test2:1:43",
"businessKey":"myBusinessKey",
"variables": []
}
response
{
"id": "45",
"url": "http://192.168.1.2:8083/activiti-rest/service/runtime/process-instances/45",
"businessKey": "myBusinessKey",
"suspended": false,
"ended": true,
"processDefinitionId": "test2:1:43",
"processDefinitionUrl": "http://192.168.1.2:8083/activiti-rest/service/repository/process-definitions/test2:1:43",
"activityId": "endevent",
"variables": [],
"tenantId": "",
"completed": true
}
11.显示流程实例列表
GET http://192.168.1.2:8083/activiti-rest/service/runtime/process-instances
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
response
{"data":[],"total":0,"start":0,"sort":"id","order":"asc","size":0}
12.获取任务列表
GET http://192.168.1.2:8083/activiti-rest/service/runtime/tasks
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
response
{
"data":[
{
"id":"58",
"url":"http://192.168.1.2:8083/activiti-rest/service/runtime/tasks/58",
"owner":null,
"assignee":null,
"delegationState":null,
"name":"Handle vacation request",
"description":"${employeeName} would like to take ${numberOfDays} day(s) of vacation (Motivation: ${vacationMotivation}).",
"createTime":"2019-06-19T08:27:26.884Z",
"dueDate":null,
"priority":50,
"suspended":false,
"taskDefinitionKey":"handleRequest",
"tenantId":"",
"category":null,
"formKey":null,
"parentTaskId":null,
"parentTaskUrl":null,
"executionId":"52",
"executionUrl":"http://192.168.1.2:8083/activiti-rest/service/runtime/executions/52",
"processInstanceId":"52",
"processInstanceUrl":"http://192.168.1.2:8083/activiti-rest/service/runtime/process-instances/52",
"processDefinitionId":"vacationRequest:1:33",
"processDefinitionUrl":"http://192.168.1.2:8083/activiti-rest/service/repository/process-definitions/vacationRequest:1:33",
"variables":[
]
}
],
"total":1,
"start":0,
"sort":"id",
"order":"asc",
"size":1
}
13.操作任务
POST http://192.168.1.2:8083/activiti-rest/service/runtime/tasks/{taskId}
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
body
{
"action" : "complete",
"variables": [
{
"name" : "vacationApproved",
"value" : true
}
]
}
response
None
14.提交任务表单数据
POST http://192.168.1.2:8083/activiti-rest/service/form/form-data
header
{"Authorization":"Basic a2VybWl0Omtlcm1pdA=="}
body
1.
{
"taskId" : "5",
"properties" : [
{
"id" : "room",
"value" : "normal"
}
]
}
2.{
"processDefinitionId" : "5",
"businessKey" : "myKey", (optional)
"properties" : [
{
"id" : "room",
"value" : "normal"
}
]
}