问题解决参考的原文链接:https://bbs.huaweicloud.com/blogs/143206
启动流程实例命令:
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ "processDefinitionKey":"holidayRequest", "variables": [ { "name":"employee", "value": "John Doe" }, { "name":"nrOfHolidays", "value": 7 }]}' http://localhost:8080/flowable-rest/service/runtime/process-instances
报错内容:
{"message":"Bad request","exception":"JSON parse error: Unexpected character (''' (code 39)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character (''' (code 39)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (PushbackInputStream); line: 1, column: 2]"}
修改后命令(单引号改双引号,json数据中的值双引号前加 \ 转义---可以去上面得链接中赋值):
curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d "{ \"processDefinitionKey\":\"holidayRequest\", \"variables\": [ { \"name\":\"employee\", \"value\": \"John Doe\" }, { \"name\" :\"nrOfHolidays\", \"value\": \"7\" }]}" http://localhost:8080/flowable-rest/service/runtime/process-instances
正确输出内容:
{"id":"c99e7ee3-8f73-11ea-94f2-005056c00001","url":"http://localhost:8080/flowable-rest/service/runtime/process-instances/c99e7ee3-8f73-11ea-94f2-005056c00001","name":null,"businessKey":null,"suspended":false,"ended":false,"processDefinitionId":"holidayRequest:6:3d24a3a2-8f6d-11ea-94f2-005056c00001","processDefinitionUrl":"http://localhost:8080/flowable-rest/service/repository/process-definitions/holidayRequest:6:3d24a3a2-8f6d-11ea-94f2-005056c00001","processDefinitionName":"Holiday Request","processDefinitionDescription":null,"activityId":null,"startUserId":"rest-admin","startTime":"2020-05-06T16:30:05.477+08:00","variables":[{"name":"nrOfHolidays","type":"string","value":"7","scope":"local"},{"name":"employee","type":"string","value":"John Doe","scope":"local"}],"callbackId":null,"callbackType":null,"referenceId":null,"referenceType":null,"tenantId":"","completed":false}