How to get only number of records with Rest API filter conditions

Krishna Chaitan
Tera Expert

Hi all, we have given Rest API url to other tool to fetch records from one table. As there are more records, they wanted to call two or three time and use sysparm_limit and sysparm_offset, but to use this, they wanted to know how many records present in the table. How to get only number of records with given condition in REST API url.

 

Also how to exclude soem particular fields in Json when querying

1 REPLY 1

arunlisp
Giga Contributor

Hi Krishna,
Would you try making the below API call to obtain record count?
https://<ServiceNowInstanceName>.service-now.com/api/now/v1/stats/incident?sysparm_query=sys_updated_on>=javascript&colon;gs.dateGenerate('2023-01-01','00:00:00')^sys_updated_on<=javascript&colon;gs.dateGenerate('2023-12-31','23:59:59')&sysparm_count=true&api=api