Work with responses
Pagination
Walk a collection past the first page with an opaque cursor.
Collections return a cursor; pass it back unchanged to get the next page.
cURL
cursor=""
while :; do
page=$(curl -sS -H "X-API-Key: $TAILEND_API_KEY" \
--get "https://api.tailend.dev/v1/philadelphia/events" \
--data-urlencode "cursor=$cursor")
echo "$page" | jq '.data[].name'
cursor=$(echo "$page" | jq -r '.meta.next_cursor // empty')
[ -z "$cursor" ] && break
donemeta.next_cursor is null once there's nothing left; meta.has_more says the same thing without you having to check for null.
What to do
- Treat the cursor as opaque. Don't parse it, store fields out of it, or construct one by hand โ a hand-built cursor is a
400. - A cursor is bound to the request that issued it: same route, resource, and filters. Change a filter and start the traversal over.
/v1/{metro}/aroundpages each result group independently โ a cursor from one group only advances that group.- For a traversal that must not miss a row, prefer
changed_since(sync mode) over browse-mode paging; see the endpoint reference for the exact contract on each collection.