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"// The SDK follows the cursor until the list runs out.
for await (const screen of vojo.screens.list({ limit: 100 })) {
console.log(screen.name);
}# The SDK follows the cursor until the list runs out.
for screen in client.screens.list(limit=100):
print(screen.name)// The SDK follows the cursor until the list runs out.
for screen, err := range client.Screens.List(ctx, &vojo.ScreensListQuery{Limit: 100}).All() {
if err != nil {
log.Fatal(err)
}
fmt.Println(screen.Name)
}// The SDK follows the cursor until the list runs out.
for (Screen screen : client.screens().list(ScreensListParams.builder().limit(100).build())) {
System.out.println(screen.getName());
}Cursors are opaque, so don't build or edit them. A malformed or expired cursor returns 400 invalid_cursor.
An SDK list loop can stop with a pagination error against the mock server, on purpose. Where the example page says there's more, the mock replays it with the same cursor, so a loop would never end. Fetch one page at a time against the mock.