How to control the READ operation via Table API from a 3rd party tool?

Suggy
Giga Sage

One of the team is using ServiceNow table API to read all the incidents using GET method. They are using something like sysparm_limit=50000 etc (which will ofcourse override the defauly 10k limit)

Though we are telling them to use pagination, they are sometimes not doing that.

So we are looking for a way to control it from ServiceNow side only. Is it possible to control in ServiceNow?

 

6 REPLIES 6

Sulabh Garg
Mega Sage
Mega Sage

Hi suggy,

You can use Pagination where you can specify the number of records to be pulled in every REST API call.

Exporting Bulk Data from Servicenow via REST Web Service Pagination

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 
  • sysparm_query=ORDERBYsys_created_on: to sort the list of records based on the created date/time 

In this case, the first call would be something like 

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

the second one 

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

the third one 

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

. and so on...

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

Resolution

It is always a best practice not to keep the value of sysparm_limit in check as the default Quota Rules for REST API transactions is set to 60 secs per transaction and increasing sysparm_limit drastically can cause the transaction to time out and get canceled. Default quota rules


Please Mark ✅ Correct/helpful, if applicable, Thanks!! 
Regards
Sulabh Garg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Please Mark ✅ Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

Hey @Sulabh Garg I know that, but I am looking for a way to control that from ServiceNow.

I just updated my question with more clarification. Thank you 🙂

Hi Suggy,

In that case, you can set the "Rate limit rules"  present under (System web service -> Rate Limit Rules). Here you can handle the incoming REST API requests from ServiceNow itself.

Inbound REST API rate limiting

To prevent excessive inbound REST API requests, set rules that limit the number of inbound REST API requests processed per hour. You can create rules to limit requests for specific users, users with specific roles, or all users.

You can check the link above to apply as per your requirement.

Hope it helps!!

 


Please Mark ✅ Correct/helpful, if applicable, Thanks!! 
Regards
Sulabh Garg

 

Please Mark ✅ Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg