Issue
I have a Camunda process called partnerPortal. This accepts 3 variables as,
{
"variables": {
"userId" : {
"value" : "user1"
},
"userName" : {
"value" : "childProtect"
},
"accountType" : {
"value" : "ideamart"
}
}
}
I call this process using Camunda rest-engine with the endpoint "engine-rest/process-definition/key/{processId}/start" using a separate spring-boot application. My requirement is, I want to return data from the Camunda-engine to the external spring-boot application when the process completes (Just like a regular API call).
For example, if I start the process using "engine-rest/process-definition/key/partnerPortal/start", I want to receive a JSON array from the Camunda engine to the spring-boot application.
Solution
https://docs.camunda.org/manual/7.16/reference/rest/process-definition/post-start-process-instance/
Request Body:
- withVariablesInReturn
Indicates if the variables, which was used by the process instance during execution, should be returned. Default value: false
Request
POST /process-definition/aProcessDefinitionId/start
POST /process-definition/key/aProcessDefinitionKey/start
Request body:
{
"variables": {
"someDate": {
"value": "2021-09-08T00:00:00.0+0000",
"type": "date"
}
},
"withVariablesInReturn": true
}
Response
{
"links": [
{
"method": "GET",
"href": "http://localhost:8080/engine-rest/process-instance/d1d09e6b-99d0-11ec-b2a5-00ff01996606",
"rel": "self"
}
],
"id": "d1d09e6b-99d0-11ec-b2a5-00ff01996606",
"definitionId": "tcb-process:2:902391b6-99d0-11ec-b2a5-00ff01996606",
"businessKey": null,
"caseInstanceId": null,
"ended": true,
"suspended": false,
"tenantId": null,
"variables": {
"result": {
"type": "String",
"value": "abc",
"valueInfo": {}
},
"someDate": {
"type": "Date",
"value": "2021-09-08T08:00:00.000+0800",
"valueInfo": {}
}
}
}
Answered By - rob2universe
Answer Checked By - Timothy Miller (JavaFixing Admin)