Reputation: 85
I am unable to get total result count in service now Rest api. I am creating query but It return the results .I want to get the results with total result count So that I may implement paging.
https:///api/now/table/kb_knowledge?sysparm_limit=10&sysparm_offset=0
Upvotes: 2
Views: 4356
Reputation: 56
You may use the X-Total-Count in the response headers. According to the documentation (https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c_TableAPI), this parameter should only return the count of records for the request you passed.
But from what I am seeing, it always returns total count of records available for that table object.
For instance, your request - https:///api/now/table/kb_knowledge?sysparm_limit=10&sysparm_offset=0
should result in X-Total-Count = 10
but it returns the total number of records available for kb_knowledge
table object.
Upvotes: 3
Reputation: 11
had the same issue but if you use the stats API you can use this parameter
https:///api/now/stats/kb_knowledge?sysparm_count=true
you'll get this response
{
"result": {
"stats": {
"count": "34"
}
}
}
Upvotes: 1