Pagination
Many endpoints in the MTOA API return a collection of records. In some cases, we also support the concept of pagination, where instead of returning all of the results in a single response, we return them in smaller sets called pages. This approach allows us to keep the performance high on the server, and also minimizes the size of our responses by breaking them into smaller, more manageable blocks.
When an endpoint supports pagination, it will accept page
and pagesize
query string to allow you to control the paging. The pagesize
parameter represents the number of records to return, while the page
parameter represents the specific page of results for the given pagesize
.
Here’s an example request for returning the first 50 feedback of a service Id via the Feedback (GetByServiceId) endpoint and the pagesize
query string parameter:
GET
/api/v1/feedback/services/{serviceId}?pageSize=50
To retrieve the next 50 records, include page to skip the first 50 records:
GET
/api/v1/feedback/services/{serviceId}?page=2&pageSize=50
Best Practice
There is no maximum limit on pagesize
. However, the pagesize
you choose can affect the performance of the servers. To improve the speed and efficiency of the APIs:
It is advised to use extra filters when doing searches.
Pick a reasonable
pagesize
to return only the data needed at the moment. Especially when returning data for human consumption, not all data may be needed immediately.It is NOT recommended to set the
pagesize
to some arbitrarily large number in an effect to circumvent the pagination feature.