Any example to Import JSON data with Data Source and import Queue in a Script Include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2020 06:38 AM
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?
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2020 05:34 PM
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