HTTP-Connector POST Payload configuration and GET URL Parameters with variables?

The docs for HTTP Connector indicate that you can use the method POST and the parameter payload to send a POST request:

The Payload does not seem to support the Map type, and you cannot seem to use script with JavaScript and generate something like: {“q”:“test one two three”}.

Here is a example of a POST Payload for the following URL:

{“q”:“SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))”}

Could Camunda provide some further documentation on how to create payloads that are KeyValues to be used in a POST payload?

Also for GET requests, the engine does not like non-friendly URL characters and the engine won’t convert into a proper format for the web.
The GET issue was resolved by using Inline javascript for the URL field. For future reference by anyone else looking at this, make sure to use the encodeURIComponent rather than just the encodeURI.:
""+ encodeURIComponent ("SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))");

Here is a example: name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))

How do we convert the format in the config?
Additionally how can we inject variables? Standard ${} format?

Related pages/docs:!topic/camunda-bpm-users/CW3MCtMc_dA!topic/camunda-bpm-users/aGVJKXGFOLE (this user seemed to have same issue)

Issues Resolved.

1 Like

Okay did some more testing. Unless there is a blatant mistake in my config for this simple example, the docs are incorrect or the payload parameter does not work.

POST_WS_Test.bpmn (6.5 KB)

It is sending the requests to:, and the GET works, but the payload for POST never arrives.

Seems this issue was raised in 2014:!topic/camunda-bpm-users/aGVJKXGFOLE

@menski was this ever identified as a issue?

GET Issue was resolved, but POST issue remains. see original post for GET resolution

Hi Stephen,

I checked your process and indeed, it didn’t work with, but it worked with hookbin.
I have uploaded a simple maven project with your process, which uses mockserver to intercept and verify the requests and they are send correctly. Run the project with mvn test and you can inspect the log output afterwards.
I changed your process so your requests run against mockserver and also added the header content-type: application/json for the POST request.


@hawky4s were you also able to get it to function with: “”+ encodeURIComponent (“SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))”); ?

See this commit how I store the query as an process variable and use it as payload.

Hi Stephen,

I updated the example with your URL and also showed how to use Camunda Spin / JsonPath with the http-connector.


@hawky4s Thanks for the details. Looks like it was the Content-Type header that was causing the problem.

On a related note, I see if your parseresults.js code you reference connector. Is there a list of internal names for referencing different objects in Camunda?

On related note, this is what the final code example looked like; used inline Javascript for the Payload:

var lat = execution.getVariable("Latitude");
var long = execution.getVariable("Longitude");

'{"q":"SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(' + lat + ',' + long + '))"}';

Response was inline Javascript that parsed as: S(response).prop("rows").elements().get(0).prop("number").numberValue();

(in this example did not need to provide any error handling)

If you have better implementation suggestions, happy to receive.

Hi Stephen,

If I am having a Url: “https://abc/xyz” and I will get a XML response from hitting it.
So for that what should be my http-connector configurations (Input and Output parameters) in the BPMN?


@Tushar read through Camunda’s Spin documentation on how to parse XML responses:

Everything should be the same but how you parse will be tailored for the XML using SPIN.


I am getting XML response from HTTP Connector (Service Task) as follows:


Now, in output Parameter of the Service Task I configured as follows to fetch “abc” from the XML

          Name: myUrl
          Type: Script
          ScriptFormat: JavaScript
          ScriptType: Inline Script
          Script: var xml = S(response);
                       xmlName = xml.xPath("/product/categories[0]/code").element();


Cannot instantiate process definition Hybris:38:d4b6fb29-a1ab-11e6-a73a-d43d7ec7ada1: Unable to evaluate script: Wrapped org.camunda.spin.xml.SpinXPathException: SPIN/DOM-XML-01035 Unable to find XPath expression ‘/product/categories[0]/code’ (#2) in at line number 2

What exactly should I Write in SCRIPT to fetch abc???


I haven’t tested your specific example, but XPath uses 1-based indices for collections, so the correct XPath should be “/product/categories[1]/code”.