curl 简易教程:http://www.ruanyifeng.com/blog/2011/09/curl.html
curl
--user name:password 登陆验证
-H http协议 header
-X 表示动作, 可以跟POST, DELETE 。。。
-d 表示data, post 后面-d 接数据 -d '{ "candidateGroup" : "managers" }'
curl 测试demo
查询已部署流程定义:
curl --user rest-admin:test http://localhost:8080/flowable-rest/service/repository/process-definitions
创建流程实例:
参数: processDefinitionKey 流程 key
variables 可变参数数组,以 {“name”:"","value":""} 格式传参
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ "processDefinitionKey":"ProjectManage", "variables": [{"name":"create_user","value":"lxy"}]}' http://localhost:8080/flowable-rest/service/runtime/process-instances
{"id":"7afae5e2-8967-11e8-81b1-e2b7b33170e0","url":"http://localhost:8080/flowable-rest/service/runtime/process-instances/7afae5e2-8967-11e8-81b1-e2b7b33170e0","businessKey":null,"suspended":false,"ended":false,"processDefinitionId":"ProjectManage:1:35a7f877-8966-11e8-91e2-e2b7b33170e0","processDefinitionUrl":"http://localhost:8080/flowable-rest/service/repository/process-definitions/ProjectManage:1:35a7f877-8966-11e8-91e2-e2b7b33170e0","activityId":null,"variables":[],"tenantId":"","completed":false}
查询任务:
//查询某个用户组任务
参数:candidateGroup 用户组名
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ "candidateGroup" : "develop" }' http://localhost:8080/flowable-rest/service/query/tasks
//查询全部
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ }' http://localhost:8080/flowable-rest/service/query/tasks
{"data":[{"id":"1f17613c-8968-11e8-81b1-e2b7b33170e0","url":"http://localhost:8080/flowable-rest/service/runtime/tasks/1f17613c-8968-11e8-81b1-e2b7b33170e0","owner":null,"assignee":null,"delegationState":null,"name":"提交审核","description":null,"createTime":"2018-07-17T10:21:32.603+08:00","dueDate":null,"priority":50,"suspended":false,"taskDefinitionKey":"sid-04B948CE-A57F-4F29-9F2F-6110845F3B9E","tenantId":"","category":null,"formKey":null,"parentTaskId":null,"parentTaskUrl":null,"executionId":"7afae5e4-8967-11e8-81b1-e2b7b33170e0","executionUrl":"http://localhost:8080/flowable-rest/service/runtime/executions/7afae5e4-8967-11e8-81b1-e2b7b33170e0","processInstanceId":"7afae5e2-8967-11e8-81b1-e2b7b33170e0","processInstanceUrl":"http://localhost:8080/flowable-rest/service/runtime/process-instances/7afae5e2-8967-11e8-81b1-e2b7b33170e0","processDefinitionId":"ProjectManage:1:35a7f877-8966-11e8-91e2-e2b7b33170e0","processDefinitionUrl":"http://localhost:8080/flowable-rest/service/repository/process-definitions/ProjectManage:1:35a7f877-8966-11e8-91e2-e2b7b33170e0","variables":[]}],"total":1,"start":0,"sort":"id","order":"asc","size":1}
得到任务id
完成任务:
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ "action" : "complete", "variables" : [] }' http://localhost:8080/flowable-rest/service/runtime/tasks/{task_id}
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ "action" : "complete", "variables" : [ { "name" : "d_verify" ,"value" : 0} ] }' http://localhost:8080/flowable-rest/service/runtime/tasks/15394566-896f-11e8-81b1-e2b7b33170e0
{"data":[{"id":"15394566-896f-11e8-81b1-e2b7b33170e0","url":"http://localhost:8080/flowable-rest/service/runtime/tasks/15394566-896f-11e8-81b1-e2b7b33170e0","owner":null,"assignee":null,"delegationState":null,"name":"审核或分派","description":null,"createTime":"2018-07-17T11:11:22.525+08:00","dueDate":null,"priority":50,"suspended":false,"taskDefinitionKey":"verify","tenantId":"","category":null,"formKey":null,"parentTaskId":null,"parentTaskUrl":null,"executionId":"7afae5e4-8967-11e8-81b1-e2b7b33170e0","executionUrl":"http://localhost:8080/flowable-rest/service/runtime/executions/7afae5e4-8967-11e8-81b1-e2b7b33170e0","processInstanceId":"7afae5e2-8967-11e8-81b1-e2b7b33170e0","processInstanceUrl":"http://localhost:8080/flowable-rest/service/runtime/process-instances/7afae5e2-8967-11e8-81b1-e2b7b33170e0","processDefinitionId":"ProjectManage:1:35a7f877-8966-11e8-91e2-e2b7b33170e0","processDefinitionUrl":"http://localhost:8080/flowable-rest/service/repository/process-definitions/ProjectManage:1:35a7f877-8966-11e8-91e2-e2b7b33170e0","variables":[]}]