Postcall in Service task

I tried making a get call via the bpmn model, and it was successful. Now, I want to make a post call instead. I set the following input parameters:
URL, headers, method, payload.
I want to know how to send the parameters of a post call, and also on how to read the response.

  1. What format does “payload” have to be in, “text” or “javascript”? Do I send it as JSON?
  2. What are the output parameters to be used? What would the script in the output parameter be?

Hi Shrisha,

What tool are you using? Could you share a screenshot of what you’re trying to achieve?

1 Like

Hey,
I am using Camunda Modeler.
I want to know how to send the parameters of a post call, and also on how to read the response!
basically, the contents of “payload” and “bodyresponse”.

Hi Shrisha,

Thanks for clarifying!

Here’s a blog post with a section halfway through on making requests via the Camunda Connector which may answer your questions.

Let me know if there is anything that is still unclear.

Best,
Gustavo

Hey, thanks. I had already read the blog post before posting my query here. The blog post talks about retrieving variables from the database. But, in my case, I don’t have any database so I want to send the payload data from the bpmn itself.
Hence, want to know what goes into “payload”.

Thanks,
Shrisha

Not sure if I understand you correctly. Could you elaborate more on your use case? Please tell us what is the goal that you want to achieve.

Thanks for the reply.
Basically, I want to make a post call via a service task. I want to send the contents of a process variable as the payload of the post call.

Thanks,
Shrisha.

Then the format of the payload depends on what your server expects. If it’s JSON, set the correct header (Content-Type: application/json) and use JSON for the payload. You can access the process variables in a script as shown in the blog post, so a script might be the preferable type of the input payload property.

Thanks for the prompt reply.:grinning:
The server expects “application/x-www-form-urlencoded” content, so have set it respectively.
As shown in the screenshot, I want to send these four fields as the payload of the post call. How do I do it?1

Please refer to MDN guide on POST to learn about how to prepare a form payload :slight_smile:.

Thanks a lot, finally got it working

1 Like

Sorry, but I need one last help.


The first post call{access token service task} returns a value(a bearer token) which is stored in a process variable. Now, I want to send the same value as “authorization” in the next post call{app create service task} made. How to I set it in the service task headers?

Have you tried to script the variable (${auth})?