Pagination¶
List operations return a page of results and a cursor for the next page:
| Parameter | Meaning |
|---|---|
limit |
Page size, 1 to 100. The default is 50, and a value outside the range is moved to the nearest limit |
cursor |
The next_cursor from the previous page |
next_cursor is null on the last page.
Treat a cursor as opaque, and pass it back exactly as you received it. A cursor the API didn't issue answers 400 invalid_cursor. Because a cursor marks a position rather than a page number, rows added between requests don't make others repeat or go missing.
Read every page¶
cursor=""
while :; do
page=$(curl -s -G "$BASE/orgs" \
-H "Authorization: Bearer $BREQWATR_API_KEY" \
--data-urlencode "limit=100" \
${cursor:+--data-urlencode "cursor=$cursor"})
echo "$page" | jq -r '.data[].name'
cursor=$(echo "$page" | jq -r '.next_cursor // empty')
[ -z "$cursor" ] && break
done
Each list operation's order is in the Reference.