ResT-API Start Process Instance change

Hello Camunda Community,
i’m working with the camunda rest api and found a litte “mistake”.

I want to start a new workflow and found this api call:
https://docs.camunda.org/manual/7.4/reference/rest/process-definition/post-start-process-instance/

Yes this works, but it’s a little bit unclean, because you don’t use an JSON Array for multiple variables.
Your request looks so:

{“variables”:
{“aVariable” : {“value” : “aStringValue”, “type”: “String”},
“anotherVariable” : {“value” : true, “type”: “Boolean”}},
“businessKey” : “myBusinessKey”
}

Now when i try to parse objects with the “gson”-lib, i can’t rebuild this request, because a list of ofjects will be parsed as an array:

{“variables”:
[
{“variableName”: “myVariable”, “value” : “aStringValue”, “type”: “String”},
{“variableName”: “anotherVariable”, “value” : “aStringValue”, “type”: “String”},
]
“businessKey” : “myBusinessKey”
}

So i have to build this request manualy instead of generating it with “gson”.

It would be very nice, if you could change this in future :slightly_smiling:

Regards

I do not believe it is “unclean” to have an object instead of an array when a collection is made of objects having a property (in this case “variableName”) which has to be unique.
At least in JS.

Hi,

Without knowing gson, I guess you can produce the desired output if you serialize a Map<String, YourVariableRepresentation> where the variable names are the map’s keys.

Cheers,
Thorben