Any example to Import JSON data with Data Source and import Queue in a Script Include

Noman Latif
Kilo Explorer

I am looking for an example to Import JSON data with Data Source and import Queue in a Script Include.

What I want to achieve is 

1. I am fetching the data with using sn_ws.RESTMessageV2. The data is in JSON format. Then I am creating  a file (using GlideSysAttachment). 

2. I want to create Vulnerability Import Queue with a Data Source

3. Attach the JSON file to the Import Queue Record

Can I find any example script this?

1 REPLY 1

kklosterman
Giga Guru

You could create a scheduled job that calls the webservice, parses the json and then use the SN API for Import Sets

https://developer.servicenow.com/app.do#!/rest_api_doc?v=newyork&id=c_ImportSetAPI

 

This would allow you to not have to create a file and attach it to the data source.

 

Steps would be a scheduled job that runs a script

* Call Web Service

* Parse Response and Build JSON object

* Pass JSON Object to ImportSetAPI