Skip to content
Last updated

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

PropertyTypeDescription
contentArrayThe list of items (your entities or DTOs) for this page.
pageableObjectDetails about the requested page and sorting (see below).
pageable.sortObjectSorting info (sorted, unsorted, empty).
pageable.offsetNumberZero-based index of the first element in the page (pageNumber * pageSize).
pageable.pageNumberNumberZero-based page number (e.g., 0 = first page).
pageable.pageSizeNumberThe requested page size.
pageable.pagedBooleanWhether paging was requested (true) or unpaged (false).
pageable.unpagedBooleanWhether paging was disabled (true).
sortObjectSorting info again (same as pageable.sort).
numberNumberCurrent page number (zero-based).
sizeNumberThe size of the page (number of items requested per page).
numberOfElementsNumberNumber of items actually returned in content (may be less than size on the last page).
totalElementsNumberTotal number of items matching the query across all pages.
totalPagesNumberTotal number of pages available given totalElements and size.
firstBooleantrue if this is the first page.
lastBooleantrue if this is the last page.
emptyBooleantrue if the page has no content.