In my process, I’m making a POST call, and the answer is set to an external JS, as shown on the Rest service task github. However I don’t understand well its syntax. As you know it looks like this:
// fetch execution variables
var response = connector.getVariable("response");
var date = connector.getVariable("date");
// parse response variable with camunda-spin
var holidays = S(response);
var query = "$.[?(@.datum=='" + date + "')]";
// use camunda-spin jsonPath to test if date is a holiday
!holidays.jsonPath(query).elementList().isEmpty();
My output parameter for the call is a script like this one. But my Rest response will be a JSON like this :
{
“creditSuccess”: “YES”,
“message”: “aMessage”
}
I’d like to map each of these two values in two process variables I already have. I’ve seen this topic :
But didn’t understand well the code samples. Here is a screenshot of my connector :
Don’t mean to hijack your post here, but is there any way to get the payload that was constructed by the HTTP connector so that we’ll know exactly what was sent? Otherwise you have to rely on a simulated value (as when you use Freemarker) or wire level capture (WireShark).
var response = connector.getVariable(“response”);
obj = JSON.parse(response);
obj.status
If I want “status” in REST response. However I’m not sure how to map, on the other side, a process var to JSON payload entries. For example, with groovy, the payload
{
“subscriptions”: ${subscriptions}
}
does not seem to work.