REST API Integration not working while using the PUT method to update incident on another SNOW instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2020 07:35 PM
Hi,
I am new to REST API Integration, still exploring the ServiceNow learning curve. I am trying to implement an eBonding integration between two SN instances - SN1 (source) and SN2 (target).
I am able to successfully create the incident. However, when I am trying to update the incident using the "PUT" method, any update in SN1 is not being reflected in SN2. For your reference, I am providing the BR below, would really appreciate some help here?
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var body = {
"short_description": current.short_description.toString(),
"description": current.description.toString(),
"caller_id": current.getDisplayValue('caller_id'),
"state": current.getDisplayValue('state'),
"impact": current.getDisplayValue('impact'),
"urgency": current.getDisplayValue('urgency')
};
var corID = current.getValue('correlation_id');
try {
var r = new sn_ws.RESTMessageV2('TDC Integration', 'Default PUT');
r.setEndpoint('https://dev100277.service-now.com/api/now/table/incident/'+corID);
r.setRequestBody(JSON.stringify(body));
//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthenticationProfile(authentication type, profile name);
//set a MID server name if one wants to run the message on MID
//r.setMIDServer('MY_MID_SERVER');
//if the message is configured to communicate through ECC queue, either
//by setting a MID server or calling executeAsync, one needs to set skip_sensor
//to true. Otherwise, one may get an intermittent error that the response body is null
//r.setEccParameter('skip_sensor', true);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex) {
var message = ex.message;
}
})(current, previous);
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2020 07:43 PM
I have placed few logs, please execute and let me know what you get in the logs. Also, please make sure credentials and sys_id is correct.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var body = {
"short_description": current.short_description.toString(),
"description": current.description.toString(),
"caller_id": current.getDisplayValue('caller_id'),
"state": current.getDisplayValue('state'),
"impact": current.getDisplayValue('impact'),
"urgency": current.getDisplayValue('urgency')
};
var corID = current.getValue('correlation_id');
try {
var r = new sn_ws.RESTMessageV2();
r.setEndpoint('https://dev100277.service-now.com/api/now/table/incident/' + corID);
r.setHttpMethod("put");
r.setRequestBody(JSON.stringify(body));
var requestBody = r.getRequestBody();
gs.info("SH - "+ requestBody);
//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthenticationProfile(authentication type, profile name);
var response = r.execute();
var responseBody = response.getBody();
gs.info("SH - " + responseBody);
var httpStatus = response.getStatusCode();
gs.info("SH - " + httpStatus);
} catch (ex) {
var message = ex.message;
}
})(current, previous);
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 05:04 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 05:14 PM
Hi Suhan,
By looking at the error message you should verify two things.
- The sys_id you are using to update the record is correct?
- All the write roles required to write the incident record is given to service/api account?
- Try using PATCH request instead of PUT. I had faced issues with PUT request but that was year back when I had implemented the same integration.
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 06:39 AM
Hi
In eBonding Spoke we have update action available that you can leverage to update the remote incident.
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad