- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2016 06:04 AM
As per the requirement, the third party tool is supposed to send multiple records in a single REST request.
Can Service Now import set API consume the multiple record JSON to create/update records on target table?
If yes, what should be the format of JSON string?
As per the initial analysis, I found the wiki article on JSONv2, but it does not seem to be working with REST request.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 02:34 AM
Yes, a scripted REST API is going to be a better way to go in this case (over a processor). The biggest advantage is that you can use versioning so one app can continue to use v1 (perhaps with no URI parameters) while another app can use v2 (with two URI parameters) simultaneously. Processors cannot do that. You need to maintain two separate processors which can be cumbersome. There are other advantages as well.
Check Episode 23 here: TechNow Episode List
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2017 02:38 PM
I tried with the following code
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response)
{
var gr;
var requestBody = request.body;
var requestData = requestBody.data; //May be an array or a single object
if (requestData instanceof Array)
{
gr=new GlideRecord('u_samplerest');
gr.initialize();
for(i=0;i<requestData.length;i++)
{
gr.country=requestData[i].country;
gr.company=requestData[i].company;
gr.employee_number=requestData[i].employeenumber;
gr.insert();
}
}
else
{
gr.country=requestData.country;
gr.company=requestData.company;
gr.employee_number=requestData.employeenumber;
gr.insert();
}
})(request, response);