Pcornel
Automation · APIs

Pagination

Cheat sheet · https://pcornel.dk/topic.php?topic=5308

Back to the Topic

Answer

Retrieval of large result sets across multiple responses using page/offset or cursor/token mechanisms.

Remember

  • First page complete ≠ dataset complete; APIs may silently enforce default limits.
  • Page number stable ≠ dataset stable; inserts/deletes between requests can shift offset-based pages.
  • Cursor token ≠ reusable forever; tokens can expire or encode server-side state.
  • No next token ≠ no hidden authorization-filtered data; pagination and visibility are separate.

First checks

  • curl -sS -D - '<api>/v1/items?page=2&per_page=100' | grep -i link — Link header pagination
  • Cursor/next token loops — completeness
  • Stop conditions — no infinite loops

Verify in this order

request page → next link/cursor → … → done

Where it usually breaks

Receiving a page proves only that subset; completeness requires following the API pagination contract to termination.

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

Pagination API boundary map

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind retries, credential rotation, replay or payload edits before evidence is captured

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5308

Confirmation

Confirm action

Continue?