REST call using http-connector and external JSON payload


#1

Hi Everyone!

I have a REST endpoint that I would like to POST to using Camunda. The payload is JSON format and I would want to test it using postman or insomnia.

In the modeler, what would be my payload? If I leave it blank, then the service is not receiving anything. Here is a screengrab of the model.

Thanks!!


#2

Your JSON goes in the VALUE box.

image


#3

I am aware that we can put the JSON payload in the Value field box. My question was - how do we use postman or insomnia or for that matter any http client to call the process engine endpoint and pass the JSON payload?

What would i put in the value field in this case?


#4

Trying to understand your question, I use SOAPui and you can register an endpoint with your method and payload, I have used other REST clients (ARC) and there is always a place to define that.


#5

I am using Insomnia and have pasted the JSON payload there and sending it to the Camunda process start endpoint. In the modeller, I have kept the Input parameter ‘Payload’ (text) value blank.

When i am posting from insomnia, i am getting this error -
Resolved [org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing

When I am posting the same JSON body in the value field of the Camunda modeller, it works fine.

What am I doing wrong?


#6

Can anyone answer this question because I am trying to do the same thing. I want to post a json payload to a camunda BPMN process and extract that json in a java class that is attached to the service node in the BPMN process.


#7

I had not used Insomnia, downloaded it and made a very simple example of accessing an endpoint and it works well. Actually I do not know what you’re doing wrong.
With more time I do a test to access the REST API of Camunda and create process instances.

I use this endpoint in the modeler for a demonstration and it works well.


#8

The endoint I am POSTing to is the Camunda process engine start endpoint - http://localhost:8080/engine-rest/process-definition/key/xxxx/start. When I POST to this endpoint from Insomnia or postman using a JSON payload, The microservice complains that it did not receive a payload(please refer to the error I have pasted in my previous comment). Question is, how do I get Camunda modeller to accept an external JSON payload? Do I have to configure the start event in the modeller in some special way? What do I put as the value field of the payload of the service event in the modeller?


#9

Here is my Insomnia -

And here is my modeller -


#10

Here I am using insomnia to start instances of processes. The payload is very specific of what you have to send to the endpoint.


#11

My Spring Boot REST Controller accepts a CustomDTO as the RequestBody.
My Payload from Insomnia or postman is as follows just like you pasted above -

{
“variables”:
{
“CustomDTO”:
{
“value”:“Stringified CustomDTO JSON”,
“type”:“json”
}
},
“businessKey”:“xxx”
}

But I am still getting the same exception from the Spring Boot app saying -

.w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.xxx.dto.CustomDTO com.xxx.controller.xxxController.createEvent(com.xxx.dto.CustomDTO) throws com.fasterxml.jackson.core.JsonParseException,com.fasterxml.jackson.databind.JsonMappingException,java.io.IOException]


#12

Any inputs anyone please?