Outbound Rest Post body in Jakarta

xstaffelbach
Kilo Contributor

I simply want to send a POST message to a server. I have a GET working from that same server already on SNOW.

I just can't figure out how to send the request body.

For instance I want to mimic this curl statement

curl -H "Content-Type: application/json" -X POST -d '{"title":"hi"}' http://live_server:5000/api/v1/incident

Where do I enter the {"title":"hi"}?

Screen Shot 2017-08-15 at 1.12.21 PM.png

This image shows the UI that I am dealing with, it looks different from the tutorial UI's so I am having trouble using them.

I cannot find the Request Body field

1 ACCEPTED SOLUTION

You need to send a string in the request body.



Change these two...


var body = {"title":"hi"};


r.setRequestBody(body);



To this:


var body = '{"title":"hi"}';


r.setRequestBody(body);



or


var body = {"title":"hi"};


var bodyText = JSON.stringify(body);


r.setRequestBody(bodyText);


View solution in original post

5 REPLIES 5

You need to send a string in the request body.



Change these two...


var body = {"title":"hi"};


r.setRequestBody(body);



To this:


var body = '{"title":"hi"}';


r.setRequestBody(body);



or


var body = {"title":"hi"};


var bodyText = JSON.stringify(body);


r.setRequestBody(bodyText);