Pagination
All top-level API resources have support for bulk fetches through “list” API methods. For example, you can list activities, contacts, and issues.
The endpoints use pagination to reduce the number of results that are returned, if the pagination parameters are not present then the default results are returned.
Default Behavior - By default, if you access the collection resource (e.g. GET /issues), the APIreturns the first page with a default size (usually 20 items per page).
Customize Pagination: You can customize the response by specifying page and size query parameters. For example, GET /issues?page=2&size=10 , retrieves the second page of results, with 10 items per page.
Hypermedia and Pagination Links
The API leverages hypermedia (HAL format by default) to enrich the response with pagination links. These links provide easy navigation between pages:
first: Link to the first page.
prev: Link to the previous page, if available.
self: Link to the current page.
next: Link to the next page, if available.
last: Link to the last page.
For example
{
"_embedded": {
"people": [
{
"name": "John Doe",
"age": 30
},
{
"name": "Jane Doe",
"age": 25
}
]
},
"_links": {
"first": {
"href": "http://example.com/people?page=0&size=2"
},
"prev": {
"href": "http://example.com/people?page=0&size=2"
},
"self": {
"href": "http://example.com/people?page=1&size=2"
},
"next": {
"href": "http://example.com/people?page=2&size=2"
},
"last": {
"href": "http://example.com/people?page=10&size=2"
}
},
"page": {
"size": 2,
"totalElements": 22,
"totalPages": 11,
"number": 1
}
}
Sorting
Along with pagination, you can also sort the data by specifying sort parameters in the query. For example, GET /people?page=1&size=10&sort=lastName,asc.