/runtime/tasks/{taskId} rest call is not showing Process Variables

Can you please help me understand, What is the right way to get the process variables when i query a given task.

As a first step, I Started a process instance using the rest call

POST http://localhost:8080/runtime/process-instances.

{
“processDefinitionKey”: “holidayRequestRama”,
“tenantId”: “2”,
“variables”: [
{
“name”: “employee”,
“value”: “bala”
},
{
“name”: “nrOfHolidays”,
“value”: 2
}
]
}

However I dont get process Variables, When I query the List of tasks using the rest call

GET http://localhost:8080/runtime/tasks/0465730d-f996-11eb-9b08-4cebbd686a99

Response received does not show process variables.

{ "id": "0465730d-f996-11eb-9b08-4cebbd686a99", "url": "[http://localhost:8081/runtime/tasks/0465730d-f996-11eb-9b08-4cebbd686a99"](http://localhost:8081/runtime/tasks/0465730d-f996-11eb-9b08-4cebbd686a99%22), "owner": null, "assignee": null, "delegationState": null, "name": "Approve or reject request", "description": null, "createTime": "2021-08-10T10:17:07.910+05:30", "dueDate": null, "priority": **50** , "suspended": false, "claimTime": null, "taskDefinitionKey": "approveTask", "scopeDefinitionId": null, "scopeId": null, "subScopeId": null, "scopeType": null, "propagatedStageInstanceId": null, "tenantId": "2", "category": null, "formKey": null, "parentTaskId": null, "parentTaskUrl": null, "executionId": "04657309-f996-11eb-9b08-4cebbd686a99", "executionUrl": "[http://localhost:8081/runtime/executions/04657309-f996-11eb-9b08-4cebbd686a99"](http://localhost:8081/runtime/executions/04657309-f996-11eb-9b08-4cebbd686a99%22), "processInstanceId": "04657306-f996-11eb-9b08-4cebbd686a99", "processInstanceUrl": "[http://localhost:8081/runtime/process-instances/04657306-f996-11eb-9b08-4cebbd686a99"](http://localhost:8081/runtime/process-instances/04657306-f996-11eb-9b08-4cebbd686a99%22), "processDefinitionId": "holidayRequestRama:1:3e026196-f44b-11eb-be05-4cebbd686a99", "processDefinitionUrl": "[http://localhost:8081/repository/process-definitions/holidayRequestRama:1:3e026196-f44b-11eb-be05-4cebbd686a99"](http://localhost:8081/repository/process-definitions/holidayRequestRama:1:3e026196-f44b-11eb-be05-4cebbd686a99%22), "variables": [] }

Hey @zikzakjack,

In order to get process variables you have to request them by passing the request parameter includeProcessVariables=true.

Cheers,
Filip

1 Like

Hello @filiphr,

Thanks a lot for the help. I could see the process variables included now.
I really missed to explore this attribute while I was exploring Swagger Docs previously.

– zikzakjack