Pagination
For requests that return a list of objects, pagination of results is available.
To do this, add the following parameters to the request:
| Parameter | Type | Description |
|---|---|---|
page |
int | Page number |
size |
int | Number of objects displayed per page |
If the number of objects per page is not specified, 10 objects will be displayed by default.
Page selection starts from page zero (0). The page count and number in the request are described by natural numbers (starting from 1). Thus, page=0 in the request corresponds to the first page.
Structure and description of the JSON object page:
| Field | Type | Description |
|---|---|---|
size |
number | Maximum number of elements displayed per page |
totalElements |
number | Total number of elements |
totalPages |
number | Total number of pages |
number |
number | Current page |
Example of a request parameter
Request /user?page=1&size=2
Returned JSON:
{
"_embedded": {
"userList": [
{
"id": "61e8fd05-aaaa-aaaa-aaaa-db72c2c33326",
"username": "user1",
"name": "name",
"surname": "surname",
"fullName": "name surname",
"avatar": "https://gitflic.ru/upload/img/6ea2b7e0-aaaa-aaaa-aaaa-7120f2ce03c1.jpg"
},
{
"id": "25a7e267-aaaa-aaaa-aaaa-b9842af9804d",
"username": "user2",
"name": "name",
"surname": "surname",
"fullName": "name surname",
"avatar": "https://gitflic.ru/upload/img/6ea2b7e0-aaaa-aaaa-aaaa-7120f2ce03c1.jpg"
}
]
},
"page": {
"size": 2,
"totalElements": 12,
"totalPages": 6,
"number": 2
}
}
Automated translation!
This page has been automatically translated. The text may contain inaccuracies.