Pagination
Retrieve large collections page by page with cursor pagination
Every OCTO list endpoint returns results in pages of up to 100 records. To read a whole collection, follow the Octo-Next-Page response header from one request to the next until it is no longer returned.
Endpoints
Cursor pagination applies to every OCTO collection endpoint, including:
GET /productsGET /bookingsGET /orders(withocto/cart)GET /webhooks(withocto/webhooks)Notification subscriptions (with
octo/notifications)
Parameters
limit
Query
Maximum number of records to return, from 1 to 100. Defaults to 100. Send it on every request.
page
Query
The cursor from the previous response's Octo-Next-Page header. Omit it on the first request.
Octo-Next-Page
An opaque cursor for the next page. Absent on the last page or when there are no results.
The response body keeps its usual shape: an array of records.
How to paginate
Example
The same loop works for products, bookings, orders and webhooks.
Rules
Treat the cursor as opaque. Don't decode, modify, construct or increment it.
Fetch pages in order. Each cursor comes from the previous response, so pages can't be requested in parallel.
Keep the request the same while traversing. Changing filters or ordering starts a new traversal. Changing
limitbetween pages is allowed.There is no total count. Use the absence of
Octo-Next-Pageas the stopping condition.Results are not a snapshot. A record that changes while you traverse can move between pages. Syncs that must not miss changes should also use Webhooks.
Browser clients can read
Octo-Next-Page; it is exposed to cross-origin requests.
Migrating from numbered pages
perPage=100
limit=100
page=1, page=2, …
No page on the first request, then page=<value of Octo-Next-Page>
Stop when you reach Octo-Total-Pages
Stop when Octo-Next-Page is absent. Octo-Total-Pages is no longer returned
Omitting page returned the whole collection
Omitting page returns the first page only. Follow Octo-Next-Page or you will only read the first 100 records
Errors
Pagination errors return 400 Bad Request with error: "BAD_REQUEST", an errorCode and a descriptive errorMessage. The errorCode is also returned in the Ventrata-Error-Code response header.
errorCode
Cause
CURSOR_PAGINATION_REQUIRED
A numeric page was sent. Start without page and follow Octo-Next-Page.
PER_PAGE_RENAMED
The obsolete perPage parameter was sent. Use limit.
INVALID_LIMIT
limit is not a whole number from 1 to 100.
A malformed or altered cursor returns BAD_REQUEST.
Questions
For help with pagination or anything else in your integration, contact connectivity@ventrata.com.