Total Asset Count

How do I query for the total count of assets? I have an API query to filter assets but it doesn’t return the total asset count.

I am using the following API:
Service Desk API for Developers | Freshservice

Hey @rightstar

Service Desk API for Developers | Freshservice returns array of assets. Can’t you get count by doing Array.length?

Hi @rightstar,
Welcome to the community !
Currently, we don’t have a public API to get the total count of assets directly, but you can use this API to list all the assets Service Desk API for Developers | Freshservice unfortunately, it is paginated, you can do a recursive call to get the assets until getting an empty response and store the count base on that.

I hope it helps

Adding on to @shravan.balasubraman and @Santhosh, unfortunately, the count is not returned as part of the JSON response body. However, this information seems to be passed via a specific response header -> X-Search-Results-Count.

The response body only returns ~30 items as of now. Obtaining the rest of the entries is possible only by following the pages. Let me know if this is what you are looking for ?

3 Likes

Yes, this should work. Thanks!

1 Like