Error 500 in REST Outbound

maneesh3
Tera Contributor

Hi Team,

 

Working on a Outbound REST message , when I trying to send addtional comments getting below error:

 

The payload is not valid JSON.","detail":""},"status":"failure"}

 

Code is like below:

 

(function executeRule(current, previous /*null when async*/ ) {

   
    var req  = new sn_ws.RESTMessageV2('SOA', 'POST');
    req.setRequestHeader("Content-Type", "application/json");
   
        //req.setRequestBody(JSON.stringify(payload));
    req.setStringParameterNoEscape('short', current.short_description);
    req.setStringParameterNoEscape('desc', current.description);
   req.setStringParameterNoEscape('comment', current.comments.getJournalEntry(1));
    req.setStringParameterNoEscape('number', current.number);
   
    req.setStringParameterNoEscape('classname', 'incident');
   
    var response = req.execute();
    var responseBody = response.getBody();
    var httpStatus = response.getStatusCode();





})(current, previous);

Please help what is missing in logic to send comments with out error








 
1 REPLY 1

Benjamin A
Mega Sage

Hi @maneesh3,

 

I think more information is needed to properly assist you in troubleshooting this issue. 

 

Go to System Web Services > Outbound > REST Messages select your rest request and then select the HTTP method and use the Related Link called Set HTTP Log Level and select All. You also will see an area to test your request here and preview script usage which may be helpful.

 

Then run your script again. 

 

Then go to System Logs > Outbound HTTP Requests, select the outbound request and screenshot the Request tab. Be sure to redact any sensitive information but include the structure of the request body and headers.

 

Thanks,

Ben