Get Record Count with REST

raghscool
Tera Contributor

Hi,


I am not able to get the count for the sys_whitelist_member table using REST calls. Any ideas?

12 REPLIES 12

ProbirDas
Tera Expert

You can use the REST Aggregate API.. You can make use of REST API explorer. I tried to get the count for the sys_user table using the below request..



HTTP Method / URIhttps://dev12270.service-now.com/api/now/v1/stats/sys_user?sysparm_limit=10&sysparm_count=true


Headers


Acceptapplication/json
Content-Typeapplication/json
X-UserToken324bf65e4f5886000bdfb5e18110c7108ca15c69e63c9ea731a3227c648402689c8cc1ba

Response Body


{ "result": { "stats": { "count": "560" } } }

Also, make sure you have access to the requested table.


Hi Probir,



Worth mentioning the REST API explorer and the REST Aggregate API are available from Fuji onwards?


Eureka and earlier do not have this functionality.



Best Regards



Tony


Is it possible to get the Count of X table with a filter applied? Something like... 

sysparm_query=active=true

Pankaj Katoch1
Mega Contributor

More likely due to restricted access.