Camunda start REST API not accepting JSON payload


#1

Camunda start REST API not accepting JSON payload.
It only accepts the format below
{
“variables”: {
“aVariable” : {
“value” : “slfkjsdlfkjsdlfkj”
}
},
“businessKey” : “payment-retrieval”
}


#2

Camunda will not accept this json doc
“address”: {
“address1”: “3388 Einstein Square”,
“address2”: “Heinz Weigenzhul Lane”,
“city”: “Pforzheim”,
“postalcode”: 55555,
“state”: “Germany”,
“country”:“Germany”,
“id”:2
}


#3

See the docs and forum on using json in the rest api.

You need to set the Variable type to json and then pass a escaped json string as the value


#4

Hi @shkrish,

can you give more information on what you try to achieve?

You can find the documentation for the “Start Process Instance” endpoint here: https://docs.camunda.org/manual/7.10/reference/rest/process-definition/post-start-process-instance/
There you will find examples on how to attach variables to the process instance.

Cheers,
Miklas


#5

I have a json payload as given. I want to call a Camunda process that I created, with just one service node. The service node will call another rest end point passing it the payload or the service node will use a java class to extract the payload from the REST call and say print out the json If I can accomplish this, I can do anything with the payload. No need to get into my real business use case.


#6

@shkrish did you attempt the modification to your REST call to camunda as i described above?


#7

{
“variables”:{
“person” : {
“value” : “\n {\n “address”: {\n “address1”: “3388 Einstein Square”,\n “address2”: “Heinz Weigenzhul Lane”,\n “city”: “Pforzheim”,\n “postalcode”: 55555,\n “state”: “Germany”,\n “country”:“Comal Germany”,\n “id”:2\n },\n “age”: 69,\n “email”: "marco@Bunte.com”,\n “first_name”: “Marco”,\n “last_name”: “Bunte”,\n “phone”: “333-222-8888”,\n “person_id”: 199\n }\n",
“type”: “json”

}

},
“businessKey” : “myBusinessKey”,
“withVariablesInReturn”: true
}


#8

The above syntax works. Thank you.


#9

yes. it is shown above


#10

OK. I think I found the problem. Many thanks for your pointer.


#11

Hi @shkrish. I am still struggling to make this work. I have used the above syntax, but still getting errors from my spring boot REST endpoint saying that the payload is missing. Could you please email me at suryamukerjee@gmail.com to help me out? I am literally struggling to make this work and the lack of proper documentation doesnt help at all. Thanks in advance!!