Pagination
Lists that grow, like messages, threads and search results, come back a page at a time.
Pages and cursors
A page has an items array and a next_cursor. Pass the cursor back as cursor for the next page; it’s null on the last one. limit sets the page size; each endpoint’s page lists its range and default.
Terminal
curl "https://api.fryll.com/channels/$CHANNEL_ID/messages?limit=100&cursor=$NEXT_CURSOR" \
-H "Authorization: Bearer $FRYLL_ACCESS_TOKEN" \
-H "X-Workspace-Id: $FRYLL_WORKSPACE_ID"Read every page
history.ts
let cursor: string | null = null;
do {
const url = new URL(`https://api.fryll.com/channels/${channelId}/messages`);
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers });
const page = await res.json();
for (const message of page.items) console.log(message.body_text);
cursor = page.next_cursor;
} while (cursor);