Is there any way to know the total amount of elements that the API call will return without executing the call or calling only a part of the elements
Is there any way to know the total amount of elements that the API call will return without executing the call or calling only a part of the elements? I just need to know the quantity, not the content.
The return of the API call is displayed in a table, however, at most 20 elements per page (c = 20 & p = 0,1,2,3,4 ...). At the first call (c = 20 & p = 0) I need to know the total amount. Even if I return only the first 20 elements, I want to know the total number of elements that will be available in the next pages (p = 1, p = 2, ...). Making a call that returns all elements (c = -1) requires a lot of processing time and is not feasible.
You should be able to run the query named
countForFind that should returns a single Long value giving you the total number of results. It actually run a query such as:
SELECT COUNT(p) FROM Product p
As you now the size of the page (20 in your example) you can easily do the division on the client side to calculate the number of pages.