Best Practices for working with REST API during slow performanceIssue <!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #6e9db4; } a:visited { font-size: 12pt; color: #7057C7; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: block; max-width: 500px !important; width: auto; height: auto; } } When querying large tables using the Table API in a ServiceNow instance, REST API requests may notice slow performance. Symptoms<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #6e9db4; } a:visited { font-size: 12pt; color: #7057C7; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: block; max-width: 500px !important; width: auto; height: auto; } } - Slow Response Times - Noticeable lag when loading data via integrations or UI widgets. - May fail due to excessive query execution time. - Large Payloads - Poor Query - Over-fetching unused data Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #6e9db4; } a:visited { font-size: 12pt; color: #7057C7; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: block; max-width: 500px !important; width: auto; height: auto; } } All Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #6e9db4; } a:visited { font-size: 12pt; color: #7057C7; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: block; max-width: 500px !important; width: auto; height: auto; } } Working with ServiceNow Table API's, below are the common fields that helps to improve performance during API calls. 1. sysparm_no_count=true In ServiceNow's REST API, the above parameter is used to prevent the execution of a COUNT(*) query when retrieving records from a table. This parameter avoids computing the total number of records, and can significantly improve performance, especially costly in large tables like incident, task etc.Faster response times and lower load on the database and don't need total count.Example: /api/now/table/incident?sysparm_no_count=true 2. sysparm_fields In ServiceNow's REST API, the above parameter is used to specify which fields should be included in the response when querying a tableThis parameter allows you to retrieve required columns from a record instead of the entire row. It can improve efficiency and reduce unnecessary data transfer or payload size.Example: /api/now/table/incident?sysparm_fields=number,short_description,priority 3. sysparm_limit and sysparm_offset In ServiceNow's REST API, the above query parameter (sysparm_limit) is used to control the number of records returned in a single response when retrieving data.Similarly, sysparm_offset is another parameter used for pagination when retrieving data, where it specifies starting point for the record retrieval, allowing you to fetch data in manageable chunks instead of massive request.Generally, sysparm_limit is often used in conjunction with sysparm_offset is always a good practice when working with larger datasets to avoid performance issues.Example: /api/now/table/incident?sysparm_limit=100&sysparm_offset=0-- The above example API fetches the first 100 incident records. To get the next 100, you would change the offset. -- if sysparm_offset=100, skip the first 100 records, and start retrieving from the 101th record. i.e., returns records from 101 to 200-- For stable pagination, always use an ORDERBY clause with query like below:-- /api/now/table/incident?sysparm_limit=100&sysparm_offset=100&sysparm_query=ORDERBYsys_created_on 4. sysparm_query In ServiceNow's REST API, this parameter is used to filter the data returned by API. It allows to specify conditions which fields should be included in the response when querying a table, it will improve query performance.Always use index your filter fields if querying large tables which will further boost query performance.Example 1: /api/now/table/incident?sysparm_query=active=true^priority=1Example 2: /api/now/table/incident?sysparm_query=sys_created_on>=2025-04-01 00:00:00^sys_created_on<=2025-07-14 23:59:59^ORDERBYsys_created_onExample 3: /api/now/table/incident?sysparm_query=sys_created_on>=javascript:gs.monthsAgoStart(3)^ORDERBYsys_created_on&sysparm_limit=100&sysparm_no_count=true Related Links<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #6e9db4; } a:visited { font-size: 12pt; color: #7057C7; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: block; max-width: 500px !important; width: auto; height: auto; } } For more details, refer to the ServiceNow Table API Documentation. https://www.servicenow.com/community/servicenow-ai-platform-articles/an-introduction-to-the-batch-rest-api-endpoint-api-now-batch/ta-p/2317136https://developer.servicenow.com/dev.do#!/guides/xanadu/now-platform/tpb-guide/scripting_technical_best_practiceshttps://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0564204