Skip to content
TrackSafe365
v1.0 Dashboard →

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

ParameterDefaultNotes
page0Zero-based page index. The first page is 0, not 1.
size20Rows per page.
sortproperty,(asc|desc). Repeatable — see Filtering & Sorting.

Envelope fields

FieldDescription
contentThe array of rows for this page.
pageThe zero-based index of the page returned.
sizeThe page size that was applied.
totalElementsTotal number of rows matching the query across all pages.
totalPagesTotal 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 size and any filters identical across requests. Because rows can be inserted or removed while you page, sort by a stable key (for example sort=id,asc) if you need a consistent ordering between calls.