Pagination
Collection endpoints return a Page envelope: the rows live in content,
and the surrounding fields describe where you are in the result set.
curl "https://dev-gw.tracksafe365.com/services/glssafety/api/public/trucks?page=0&size=20" \
-H "Authorization: $TS365_API_KEY"
{
"content": [{ "id": 1, "unitNumber": "1042" }],
"page": 0,
"size": 20,
"totalElements": 142,
"totalPages": 8
}
Parameters
| Parameter | Default | Notes |
|---|---|---|
page | 0 | Zero-based page index. The first page is 0, not 1. |
size | 20 | Rows per page. |
sort | — | property,(asc|desc). Repeatable — see Filtering & Sorting. |
Envelope fields
| Field | Description |
|---|---|
content | The array of rows for this page. |
page | The zero-based index of the page returned. |
size | The page size that was applied. |
totalElements | Total number of rows matching the query across all pages. |
totalPages | Total number of pages at the current size. |
Iterating all pages
Request page=0, then keep incrementing page until it reaches
totalPages - 1:
GET /trucks?page=0&size=50 → totalPages: 3
GET /trucks?page=1&size=50
GET /trucks?page=2&size=50 → last page
Keep
sizeand any filters identical across requests. Because rows can be inserted or removed while you page, sort by a stable key (for examplesort=id,asc) if you need a consistent ordering between calls.