Synchronous response after starting process using REST API

I have bpmn which starts with MessageStartEvent >> ServiceTask >> MessageEndEvent
ServiceTask is making call to another endpoint to retrieve PDF(basically json response with PDF in base64 format).
My requirement is if I start the process using REST call(POST call to http://localhost:8080/engine-rest/message) I should return PDF(json response with PDF in base64 format) as response back but currently I am getting 204 No Content.

What config changes I need to do so that it works in synchronous fashion where it return PDF(json response with PDF in base64 format) instead of 204.

Hi,

if you look for a method to invoke a Camunda process synchronously, I can give you a link to another post about this topic:

I hope this helps. :slight_smile:

Hi @amithsrinivasan,

you can add the parameter variablesInResultEnabled to the message correlation call and get a response from the invocation: Correlate a Message | docs.camunda.org

Hope this helps, Ingo

Hi @Ingo_Richtsmeier ,

I added resultEnabled & variablesInResultEnabled in the input JSON request and triggered but I am getting immediate response back with status code 200 and JSON which has only processVariables which I have sent as part of input.

Hi @amithsrinivasan,

the api call can only return the values that are created until ther first wait state/async continuation is reached (as @stefan_geiss explained).

In case your process uses external tasks or async continuation, you have to poll for the progress in your client and get the PDF when it’s finished.

Hope this helps, Ingo

Thanks I will check polling from client option.