
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 06:51 AM
I am building an integration between instance1 and instance2. When instance2 posts to the web service on instance1, the incident gets created correctly but I get no response body so I'm unable to pull the remote number out and set it on the initiating incident.
When I use REST API Explorer on instance1 and post to the same web service, I get the appropriate response body.
Here is my code:
var request = new sn_ws.RESTMessageV2("ABC Outbound Incident","create_incident");
request.setStringParameterNoEscape("summary",current.short_description);
request.setStringParameterNoEscape("description",jsonEncode(description + ''));
request.setStringParameterNoEscape("number",current.number);
request.setStringParameterNoEscape("company","XYZ");
request.setStringParameterNoEscape("caller","XYZHelp Desk");
request.setStringParameterNoEscape("reported_by","XYZ Help Desk");
request.setStringParameterNoEscape("urgency",urgency);
request.setStringParameterNoEscape("impact",impact);
request.setStringParameterNoEscape("group","Service Desk");
request.setStringParameterNoEscape("sysID",current.sys_id);
request.setStringParameterNoEscape("state","Queued");
request.setStringParameterNoEscape("substate","New");
request.setStringParameterNoEscape("comments",jsonEncode(comments + ''));
var response = request.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.addInfoMessage('httpStatus: ' + httpStatus);
gs.addInfoMessage('responseBody: ' + responseBody);
What is going on?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2019 06:17 AM
For anyone who stumbles on this post in the future, I fixed this by giving the user on instance1, whose credentials instance 2 was using to send data to instance1, the import_transformer role to get a response back.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2019 09:00 AM
Hi,
Can you try this line of code to execute:
var response = request.executeAsync();
// Get The Response Body
var responseBody = response.getBody();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2019 11:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2019 12:47 PM
REST API explorer might have interpreters built in for responses.
I'd check what you're getting as a response:
gs.addInfoMessage('responseBody: ' + typeof responseBody);
If it's not a string, you might need to do something with responseBody before it can display properly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2019 06:17 AM
For anyone who stumbles on this post in the future, I fixed this by giving the user on instance1, whose credentials instance 2 was using to send data to instance1, the import_transformer role to get a response back.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2023 02:00 PM
It does not help in this scenario getting reponse body from other instance as **Payload logging not supported for unknown content-type.**