Pagination
Walk through long lists with a cursor.
Lists return 25 items by default. Pass limit for up to 100 a page.
To get the next page, send meta.next_cursor back as cursor. Stop when meta.has_more is false.
{
"data": [ ... ],
"meta": { "next_cursor": "eyJ2IjoxLCJrIjpbIkxvYmJ5...", "has_more": true }
}curl "https://api.vojo-media.com/v1/screens?limit=100&cursor=$NEXT_CURSOR" \
-H "Authorization: Bearer $VOJO_KEY"import { listAll } from "@vojo/api-client";
// listAll follows the cursor until the list runs out.
for await (const screen of listAll((cursor) =>
api.GET("/v1/screens", { params: { query: { cursor, limit: 100 } } }),
)) {
console.log(screen.name);
}Cursors are opaque, so don't build or edit them. A malformed or expired cursor returns 400 invalid_cursor.
listAllthrows against the mock server, on purpose. The mock replays the same example page with the same cursor, so a loop would never end. Page by hand against the mock.