How to capture inbound json and response json logs using import set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 04:23 AM
Hi all,
Iam using import Set API to create incident ticket ,but iam bit confused to capture the logs .Please guide me to capture inbound json and response json in logs.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 04:32 AM
- Create a new true/false system property named glide.rest.debug with value true.
- Initiate a test API call from a testing tool such as REST API Explorer, Postman, etc.
- Examine the node log file.
There’s just one big problem: we don’t want to download the node log every time we make a test request, and this is where the Log File Tailer comes in handy.
Using the Log File Tailer
The Log File Tailer allows you to view the node log for the node you’re currently connected to in real time. To use it, navigate to https://.service-now.com/channel.do?sysparm_channel=logtail.This will open the Log Tailer interface.
REST debug log lines will start with something like this: 10/18/17 23:25:25 (984) 6825C50B137D8B409718B9B76144B0C1 #206480 [REST API]:
Use these lines to examine the details of the incoming request. You will see HTTP request headers, messages from the REST API code in the platform and more. A few words of warning about the Log File Tailer:
- Do not use in production
- Only keep the tailer window open for a short period of time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 04:33 AM
Also refer to this article for REST debug:
And this for returning the debug logs as a response to the JSON call:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 04:42 AM
Hi @willem
Thanks for ur reply,
Iam using onBefore script for import set API as below
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
}
Whether i can capture inbound Json in the above function ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 04:46 AM
No, in that script you only have the source and target available. Source is already the staging table in ServiceNow, not the 'raw' JSON.
You need either of the options I linked to:
- Activate REST Debugging.
- Return debug log in the Response.
What is it you want to do/check?