aeyho

Pagination

How lists come back, and how to walk through all of one with a cursor.

View as Markdown

On this page

How lists come back

A list answers with the items and a cursor for the next page:

{ "data": [ ... ], "nextCursor": "MjA" }
  • limit sets the page size: 1 to 100, 20 when left out.
  • cursor asks for the page after the one that gave it.
  • nextCursor is null on the last page.

A cursor is opaque. Don't build one, change one or keep one for long: start again from the first page instead.

Walking a list

let cursor = null;
do {
  const url = new URL("https://www.aeyho.com/api/v1/reels");
  url.searchParams.set("limit", "100");
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.AEYHO_KEY}` } });
  const page = await res.json();
  for (const reel of page.data) console.log(reel.id, reel.status);
  cursor = page.nextCursor;
} while (cursor);

The lists

ListOrderNotes
GET /brandsLast changed first
GET /brands/{brandId}/ideasThe plan's order
GET /brands/{brandId}/tasteOldest first
GET /reelsLast changed first
GET /reels/{reelId}/versionsOldest first
GET /reels/{reelId}/commentsBy moment or slide, then oldest firstAdd status=open, done or wontfix to filter.
GET /webhooksNewest first
GET /webhooks/{webhookId}/deliveriesNewest firstThe last 50, in one page.

POST /brands/{brandId}/plan answers in the same shape, with every planned idea in one page.

Try it

curl "https://www.aeyho.com/api/v1/reels?limit=2" \
  -H "Authorization: Bearer $AEYHO_KEY"