Is there a "correlation id" feature for the REST API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 11:21 AM
Hi,
Does the Service Now REST API (specifically the Table API) have the concept/feature of a "correlation id" (like Salesforce as described here)? Basically, I'd like to pass a unique id in the REST API request, have it passed back in the response (ideally), and be present in the logs so if I ever have to troubleshoot an issue, I can more easily trace everything from end-to-end from my end to Service Now and back, etc.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 08:53 PM
ServiceNow has several thousands tables, and you cannot expect that each of them will store any correlation id.
However, the table task (and all child tables) has a field correlation_id OOTB and you can use it to store the external ID. How exactly is up to you and what you then do with this information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 08:01 PM
Thanks for your reply, but I'm not asking for the tables to have/store the correlation id as a field. I'm asking if there's a way to provide an ID that will automatically be added to the logs, so if/when I have to troubleshoot its easy to trace a request from end to end. For instance, if I have an issue and I'm not sure if it's on my end or the REST API, I can gather all the logs on my end and the REST API for a single (correlation) ID to capture the full picture of the issue fairly easily.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 08:18 PM
Sorry, I still don't understand your question. Basically the partner system has to provide a unique id (co-called correlation id) what can be stored on ServiceNow side. And there is no automatic adding of anything, because it makes no sense. If you need more, you have to implement it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 08:54 PM
Hi @sndev510 ,
One of the practices for performing integrations with ServiceNow is the use of Import sets/staging tables instead of directly interacting with the target table.
Using the import set tables you will automatically get logs of what has been pushed to the table. You will also be able to make transforms (using transform maps) to the data if needed such as matching date formats from system to system. And you still can use a correlation id (most of the times I use the unique id of the record from the third party system) so that you know which ServiceNow record correlates to the third party system record.
These import sets can be used for pulling data into ServiceNow or accepting data from being pushed into ServiceNow.
Otherwise if you're just pushing data directly to the table most of the automatic errors that you'll get are from the response from your request.
These tables don't count toward table use. Out-of-box the records are purged after seven days but this can be configured to stay longer if needed so that the data can be analyzed.
I'm not sure if this is what you're looking for but it might be a good idea to at least look into it.
I hope this helps.