How to get more than 10000 records in response of GET method in REST API

sumitjumale
Kilo Contributor

I need to get more that 10000 records with the help of GET method in REST API.

Please guide me is there any property in service now to change maximum returned record.

6 REPLIES 6

ginesdoleratorm
ServiceNow Employee
ServiceNow Employee

Hi Sumit,



Increasing the maximum returned record (10000 by default) may have performance implications. What I suggest to retrieve large amounts of records is to use pagination. That is, get sub-sets of records in different calls, for example, first you get records from 1 to 10000 in a call, then you get from 10001 to 20000, then from 20001 to 30000, etc.



To do so, you can make use of the parameters


- sysparm_limit: to define how many records you get in one call (10000 by default)


- sysparm_offset: to define the records to exclude from the query



In this case, the first call would be something like


/api/now/table/incident?sysparm_limit=10000&sysparm_offset=0


the next one


/api/now/table/incident?sysparm_limit=10000&sysparm_offset=10000


the next one


/api/now/table/incident?sysparm_limit=10000&sysparm_offset=20000


...



You can put that in a loop to get all the records using pagination.


For more info you can take a look to Table API - GET /now/table/{tableName}



Hope it helps,


Ginés.


Naresh27
Tera Guru

HI Sumit, Did you find any solution on this, I have a requirement to remove the cap limit of 10,000 While using GET.

Kenneth Gonzal1
Kilo Explorer

Hello,

 

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

 

Ken.

I Know this is an old thread, but I had to comment on this for the sake of other people looking here for answer.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0727636

Sincirely,

Anders