Pagination
There are several ways to navigate through pages of data without any configuration.
- Use
sortandwhereautomatically e.g.sort=name&where=name>Frank. - A classic
page=2parameter. Maybe withsize=100parameter. - Another classic
limitandoffsetparameters. Orskipandtake.
How to include links to the next and previous pages in the response is configurable.
Link header
Firestorm can be configured to return a Link header that can be followed to get the next page.
200 OK
Link: <https://api.yourapplication.com/people?sort=name+asc&where=name%3EFrank>; rel="next"
[
{ "id": 1, "name": "Aaron" },
...
{ "id": 1234, "name": "Frank" }
]
Wrapped response
You can also configure the response body to include the page info.
GET /people?sort=name
200 OK
{
items: [
{ "id": 1, "name": "Aaron" },
...
{ "id": 1234, "name": "Frank" }
],
page: {
"next": "/people?sort=name&where=name>Frank"
}
}