
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2016 10:18 AM
I am trying to create a python script that does the following:
- Parse a CSV file
- Send the CSV file to a remote server via REST API
The code I have is working to parse the CSV file and convert it to a JSON object.
However, when it imports to ServiceNow server, only the first row is written.
NOTE: I think this is because the ServiceNow API can only handle ONE ROW PER REQUEST. I have confirmed this with the graphical REST API request creator. AS you can see in the screenshot, I am trying to load two rows of data. In my test, the first row is written and then is gets by the second row. Thus only one record is imported.
Question: Could this be an issue with ServiceNow processing the request, and how can I fix the issue?
Here is a wiki article which describes the python script template.
http://wiki.servicenow.com/index.php?title=Table_API_Python_Examples#gsc.tab=0
Message was edited by: Kathryn Amaral
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 07:54 AM
Hi Frank, I was able to get this working by using the JSONv2 API.
The REST api only allows you to insert one record:http://wiki.servicenow.com/index.php?title=Table_API#POST_.2Fapi.2Fnow.2Fv1.2Ftable.2F.28tableName.2...
We are able to use JSONv2 to insert multiple records:http://wiki.servicenow.com/index.php?title=JSONv2_Web_Service#insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 07:51 AM
Hi,
AFAIK the Inbound REST API is in fact processing your request row-by-row as of now.
I ran into the same thing last year and I got the information that this is working as designed - I don't know if we have any plans to change that but I'm happy to verify that.
As a workaround we just sent the whole JSON object to ServiceNow and decoded it on ServiceNow side. I admit it's not how it should be but it helped speeding up the import significantly.
Frank

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 07:54 AM
Hi Frank, I was able to get this working by using the JSONv2 API.
The REST api only allows you to insert one record:http://wiki.servicenow.com/index.php?title=Table_API#POST_.2Fapi.2Fnow.2Fv1.2Ftable.2F.28tableName.2...
We are able to use JSONv2 to insert multiple records:http://wiki.servicenow.com/index.php?title=JSONv2_Web_Service#insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 07:57 AM
Great catch! Happy to hear you could solve it this way
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 11:00 AM
Hey Katie...
Can you guide how did you configure JSONv2 API and how did you pass request data to it? If you could provide steps that would be helpful.