servicenowservicenow-rest-api

Unable to get total result count in service now


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


Solution

  • 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.