How to capture inbound json and response json logs using import set

String
Kilo Sage

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.

8 REPLIES 8

Willem
Giga Sage
Giga Sage
  1. Create a new true/false system property named glide.rest.debug with value true.
  2. Initiate a test API call from a testing tool such as REST API Explorer, Postman, etc.
  3. 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.

blog_rest_debug_log_file_tailer.png

 

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

 

Source: https://developer.servicenow.com/blog.do?p=/post/debugging-inbound-rest-calls-and-the-business-rules...

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 ?

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?