Pagination RESTFul API on AeroGear Controller
This document describes pagination in AeroGear. It defines the metadata passed between the client and server.
The offset of the first element that should be included in the returned collection. Default value is 0.
The number of elements that should be returned. Default value is 10
The total number of elements available.
Information about the pagination parameters, and url links to the first, previous, next, and last need to be passed from the server to the clients. There are several options available here:
- Information is passed as HTTP Response Headers
- Information is passed in the body of the Response along with the data
HTTP Response Headers
The total number of elements available is passed back to the calling client for every request. This is done as this number might change.
The url to the first set of items.
The url to the previous set of items
The url to the next set of items
The url to the last set of items
Alternatively use Web Linking:
<https://localhost/demo/cars?offset=0&limit=10>; rel="first", <https://localhost/demo/cars?offset=10&limit=10>; rel="previous", <https://localhost/demo/cars?offset=30&limit=10>; rel="next", <https://localhost/demo/cars?offset=90&limit=10>; rel="last"