We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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
Mega Sage

Try changing

power_request.setrequestBody(abc);

To

power_request.setRequestBody(abc);

View solution in original post

1 REPLY 1

Simon Christens
Mega Sage

Try changing

power_request.setrequestBody(abc);

To

power_request.setRequestBody(abc);