Workbrew API pagination
Petros Amoiridis
List endpoints in the Workbrew API return one page of results per request. This page describes the pagination contract: the request parameter, the response shape, and how to detect the last page.
Request
Pass the page number as a query string parameter:
GET /workspaces/<workspace>/<resource>.json?page=<N>
page is a 1-indexed integer. When omitted, the API returns page 1. Page size is fixed at 15 items per page and is not configurable.
Response
The response body is a JSON array of resource objects. There is no envelope and no pagination metadata in the body.
[
{ "id": "...", "...": "..." },
{ "id": "...", "...": "..." }
]
Pagination metadata is returned in response headers:
| Header | Value |
|---|---|
X-Total-Count | Total number of records across all pages, as a string. |
Link | The URL of the next page in RFC 8288 format, for example <https://console.workbrew.com/workspaces/acme/devices.json?page=2>; rel="next". Present on every page except the last. |
Requesting a page beyond the last returns HTTP 200 with an empty JSON array and no Link header.
Detecting the last page
A response is the last page when the Link header is absent. X-Total-Count divided by 15 (rounded up) gives the total number of pages.
Example
$ curl -sD - -H "Authorization: Bearer $TOKEN" \
"https://console.workbrew.com/workspaces/acme/devices.json?page=1" \
-o /dev/null
HTTP/2 200
x-total-count: 47
link: <https://console.workbrew.com/workspaces/acme/devices.json?page=2>; rel="next"
...
Related docs
- Workbrew API — overview of the API and where to find the full endpoint reference.