Skip to main content
Solved

http rest api and total count inclusion in response

  • December 12, 2024
  • 1 reply
  • 37 views

Forum|alt.badge.img

I’m currently working with the Acumatica API and noticed that some REST services typically return a totalCount field or include the total count of records as part of the metadata in their responses. However, I couldn’t find any documentation or examples indicating that Acumatica supports this feature, in fact the opposite from the links i pasted below.

Specifically, I’m looking for a way to retrieve the total number of records in a dataset (e.g., total orders or customers) alongside a paginated response. I don’t see a totalCount in the response body, nor have I found any mention of it in headers like X-Total-Count.

My questions are:

  1. Does Acumatica support returning the total count of records in the API response?
  2. If not, is there a recommended approach or workaround to efficiently retrieve the total count of records?
    • Should I rely on a separate API call to count the records?
    • Are there any best practices for handling this in Acumatica?

Any insights or suggestions would be greatly appreciated. Thanks in advance for your help!

https://stackoverflow.com/questions/42234272/total-rows-number-on-acumatica-webservice

 

Best answer by Dmitrii Naumov

@ckwiat46 there is $count in OData.

E.g. here is the request to get a count of customers in the system:

{{sitename}}/t/Company/api/odata/DAC/Customer?$count=true&$top=1

Or if you want a count in a specific GI: 

{{sitename}}/t/Company/api/odata/gi/BI-Customers?$count=true&$top=1

(Acumatica 2024 R2 Examples)

For contract based REST API there is no equivalent. 

View original
Did this topic help you find an answer to your question?

1 reply

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 629 replies
  • Answer
  • December 13, 2024

@ckwiat46 there is $count in OData.

E.g. here is the request to get a count of customers in the system:

{{sitename}}/t/Company/api/odata/DAC/Customer?$count=true&$top=1

Or if you want a count in a specific GI: 

{{sitename}}/t/Company/api/odata/gi/BI-Customers?$count=true&$top=1

(Acumatica 2024 R2 Examples)

For contract based REST API there is no equivalent. 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings