REST api not pulling back all records

JJ20
Kilo Guru

running an api call to pull all hardware records

 

$uri = "https://cscglobaldev.service-now.com/api/now/table/cmdb_ci_hardware

 

There are 14K records in the table.

 

Only 5K are getting returned (so the 10000 limit isn't even applied yet).

 

Any thoughts on what would minimize the retrieval?

 

Thanks in advance.

 

 

 

8 REPLIES 8

Hi .. I found this information interesting, yet, the REST API is paying no mind to the limit=10000.

 

 

Rahul Priyadars
Giga Sage
Giga Sage

Fetching high no of records in one go will impact performance of system. Try in chunks as below.

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

 

the next one

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

 the next one

 /api/now/table/incident?sysparm_limit=3000&sysparm_offset=6000

 refer KB - Exporting Bulk Data from Servicenow via REST Web Service Pagination

https://hi.service-now.com/kb_view.do?sysparm_article=KB0727636#:~:text=Web%20Service%20Pagination.-,Procedure,which%20default%20value%20is%2010000.

 

Regards

RP

 

Hello,

In the article ServiceNow says "You can put that in a loop to get all the records using pagination until all the records are read" do you have any idea on how to do this?

Ivan Betev
Mega Sage
Mega Sage

Hi JJ,

instead of getting all table could you limit the number of fields you requesting? By the way the more fields you request in your call the less will be the limit. 10000 is probably only for a couple of fields.

https://cscglobaldev.service-now.com/api/now/table/cmdb_ci_hardware?sysparm_fields=operational_status

I'm currently experiencing the same issue with my REST API calls that are being cut after a first iteration (I'm doing it as recommended with offset and limit). This started to happen a week ago, HI ticket is under investigation.

Have a nice one!

Regards,

Ivan