Pagination
Lists answer items and a cursor. Pass the cursor back for the next page.
Lists answer the same way everywhere:
{ "items": [ … ], "cursor": "eyJ0IjoiMjAyNi0xMS0yMFQwODowMDowMFoifQ", "total": 214 }When cursor isn't null, pass it back as ?cursor= for the next page. limit sets the page size. Some lists add total.
async function* contacts(siteId) {
let cursor = null;
do {
const url = new URL(`https://api.unvop.com/v1/sites/${siteId}/contacts`);
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const page = await (await fetch(url, { headers })).json();
yield* page.items;
cursor = page.cursor;
} while (cursor);
}
for await (const contact of contacts('site_…')) console.log(contact.email);def contacts(site_id):
cursor = None
while True:
params = {"limit": 100, **({"cursor": cursor} if cursor else {})}
page = requests.get(f"https://api.unvop.com/v1/sites/{site_id}/contacts", headers=headers, params=params).json()
yield from page["items"]
cursor = page["cursor"]
if not cursor:
break
for contact in contacts("site_…"):
print(contact["email"])Treat a cursor as opaque: don't build or change one, just send it back.
Short lists
Workflows, tools, forms, plugins and connections come whole, with cursor: null, so one request is enough. Media and payments answer the newest 500. Collection entries also accept offset for older clients, but cursor is the way to page them.