Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

why the body is not going to third party during rest call?

Manikantahere
Tera Contributor
var body = {
"short_description": "test",
"caller_id":"Abel Tuter",
"description":"testing integration"
};

 

var abc = JSON.stringify(body);
var power_request = new sn_ws.RESTMessageV2('TestInstance', 'Default Post');
power_request.setStringParameterNoEscape('baseURL', '*********************************');
power_request.setRequestHeader("Accept","application/json");
power_request.setRequestHeader("Content-Type","application/json");
power_request.setrequestBody(abc);
 
var response = power_request.execute();

 

 

var xyz = power_request.getRequestBody();

 

gs.log("the body of rest is "+xyz);

they are not getting the body that I am intended to sent to them and even when I tired to print the request body after executing the request through the log its not printing anything just I am getting "the body of rest is"

where i did wrong and what is making this not to happen?


1 ACCEPTED SOLUTION

Simon Christens
Kilo Sage

Try changing

power_request.setrequestBody(abc);

To

power_request.setRequestBody(abc);

View solution in original post

1 REPLY 1

Simon Christens
Kilo Sage

Try changing

power_request.setrequestBody(abc);

To

power_request.setRequestBody(abc);