Get specific process variables

How can I get specific variables from the instance of a Process? I tried with this GET request:

http://localhost:8080/engine-rest/process-instance/e641ec4e-a424-11eb-8abe-c4d9876d69f2/variables/FirstVariable

, but I can only get one variable at a time…

Hi @Domagoj_Hamzic,

with this request you’ll get all variables: Get Process Variables | docs.camunda.org

Here you can filter for certain process instances and variables: Get Variable Instances | docs.camunda.org

Hope this helps, Ingo

Hi @Ingo_Richtsmeier
I tried the proposed request:

http://localhost:8080/engine-rest/variable-instance?processInstanceIdIn=e641ec4e-a424-11eb-8abe-c4d9876d69f2&variableName=FirstVariableName,SecondVariableName

The Camunda responded with an empty request. The next request without a variable name parameter returns the next JSON:
http://localhost:8080/engine-rest/variable-instance?processInstanceIdIn=e641ec4e-a424-11eb-8abe-c4d9876d69f2

[
{
    "type": "Boolean",
    "value": false,
    "valueInfo": {},
    "id": "e641ec4f-a424-11eb-8abe-c4d9876d69f2",
    "name": "FirstVariableName",
    "processDefinitionId": "CamundaAdapter:1:758e4a22-a420-11eb-8abe-c4d9876d69f2",
    "processInstanceId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
    "executionId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
    "caseInstanceId": null,
    "caseExecutionId": null,
    "taskId": null,
    "batchId": null,
    "activityInstanceId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
    "errorMessage": null,
    "tenantId": null
},
{
    "type": "String",
    "value": "Trenutna vrijednost",
    "valueInfo": {},
    "id": "e641ec52-a424-11eb-8abe-c4d9876d69f2",
    "name": "SecondVariableName",
    "processDefinitionId": "CamundaAdapter:1:758e4a22-a420-11eb-8abe-c4d9876d69f2",
    "processInstanceId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
    "executionId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
    "caseInstanceId": null,
    "caseExecutionId": null,
    "taskId": null,
    "batchId": null,
    "activityInstanceId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
    "errorMessage": null,
    "tenantId": null
},
{
	"type": "String",
	"value": "Druga vrijednost",
	"valueInfo": {},
	"id": "d413ec52-a424-11eb-8abe-c4d9876d34f2",
	"name": "ThirdVariableName",
	"processDefinitionId": "CamundaAdapter:1:758e4a22-a420-11eb-8abe-c4d9876d69f2",
	"processInstanceId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
	"executionId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
	"caseInstanceId": null,
	"caseExecutionId": null,
	"taskId": null,
	"batchId": null,
	"activityInstanceId": "e641ec4e-a424-11eb-8abe-c4d9876d69f2",
	"errorMessage": null,
	"tenantId": null
}]

How to create a task if I wanna get in a one REST POST request next variables:

  • FirstVariableName
  • SecondVariableName

Hi @Domagoj_Hamzic,

the parameter variableName can only filter for a single variable.

In this case the queried name is FirstVariableName,SecondVariableName.

You have to either use two calls or filter the result set afterwards in your application.

Hope this helps, Ingo

1 Like