request limit

Arthur Sanchez
Giga Guru

Guys, I was instructed to extract data via API from an endpoint of a company that is using ServiceNow. I am part of a third-party company so I cannot change the ServiceNow of the company that provided the endpoint. My question is, I saw that to get data via GET there is a limit of up to 10 thousand records. Is there any way I can get all the records without having this limit?

5 REPLIES 5

Paul Curwen
Giga Sage

Increasing the maximum returned record (10000 by default) may have performance implications. The method I recommend to retrieve largeer amounts of records is to use pagination. It is explained very clearly in this video: 

 

https://www.youtube.com/watch?v=6A4H9lhju4s

 

IF YOU WANT QUICK AND DIRTY: 

 

The 10000 limit is being caused by omission of the parameter sysparm_limit which default value is 10000. If you specify a higher value in the URL then you can get the desired amount of records.

 

Example: /api/now/table/incident?sysparm_limit=40000

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

The problem is, I don't know how much data there is in total and unfortunately when I don't set a limit, it brings up to 10 thousand, and I can't know how much data there is in total precisely because of that, and I can't apply a limit because I don't know how much data there is, and I know that every day they increase.

Read up on sysparm_offset.

 

 

I'm trying to implement it, I'm doing gets trying to get 10 at a time, but I always get only the first 10, and not the following ones, and I don't know if my url is wrong, @thomaskennedy 

const orderby = 'ORDERBYopened_at';
const fields = 'opened_at,number';

export const url = `${baseUrl}?sysparm_query=${orderby}&sysparm_fields=${fields}&sysparm_limit=10&sysparm_offset=10`;