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 API returns 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.
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.
An overview of the data returned by the pagination is below -
Example
{
"content": [],
"pageable": {
"sort": {
"empty": true,
"unsorted": true,
"sorted": false
},
"offset": 0,
"pageNumber": 0,
"pageSize": 20,
"paged": true,
"unpaged": false
},
"last": true,
"totalPages": 1,
"totalElements": 6,
"first": true,
"size": 20,
"number": 0,
"sort": {
"empty": true,
"unsorted": true,
"sorted": false
},
"numberOfElements": 6,
"empty": false
}
Overview
Property | Type | Description |
---|---|---|
content | Array | The list of items (your entities or DTOs) for this page. |
pageable | Object | Details about the requested page and sorting (see below). |
pageable.sort | Object | Sorting info (sorted , unsorted , empty ). |
pageable.offset | Number | Zero-based index of the first element in the page (pageNumber * pageSize ). |
pageable.pageNumber | Number | Zero-based page number (e.g., 0 = first page). |
pageable.pageSize | Number | The requested page size. |
pageable.paged | Boolean | Whether paging was requested (true ) or unpaged (false ). |
pageable.unpaged | Boolean | Whether paging was disabled (true ). |
sort | Object | Sorting info again (same as pageable.sort ). |
number | Number | Current page number (zero-based). |
size | Number | The size of the page (number of items requested per page). |
numberOfElements | Number | Number of items actually returned in content (may be less than size on the last page). |
totalElements | Number | Total number of items matching the query across all pages. |
totalPages | Number | Total number of pages available given totalElements and size . |
first | Boolean | true if this is the first page. |
last | Boolean | true if this is the last page. |
empty | Boolean | true if the page has no content. |