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-30-2020 07:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 07:30 AM
As I mentioned earlier, Your Service account is missing incident update roles or may be the incident you are trying to update . Typically below roles are required to update via Rest Api.
- rest_service
- web_service_admin
- itil
In addition to above if there are any custom ACLs are in place to restrict incident update to some specific role. Your Service account must have that assigned.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2020 09:04 PM
Try using Patch method and see if it works, we noticed few issues with put method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2020 10:54 PM
Hi,
Are you using basic authentication with proper rest user credentials with proper access controls
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 05:05 PM
I am using basic auth credentials
