Learn Everything

Paths/Backend Engineer/API Design / Resource Modelling

Practice Taskintermediateubuntu:24.04Ask AI

Paginate Without Breaking Clients

Offset pagination dies at scale and breaks when rows are inserted. Write the cursor based contract and the parameters that go with it.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • File ~/api/openapi/pagination.yaml exists○
  • The parameters include a limit and a cursor○
  • The response states how the next cursor is returned○

02Walkthrough

1 of 4 revealed
  1. 01

    Write the pagination parameters

    limit caps the page size and cursor says where to continue. Both are optional, and both have documented defaults.

    echo 'parameters:\n - name: limit\n in: query\n schema:\n type: integer\n maximum: 100\n default: 25\n - name: cursor\n in: query\n schema:\n type: string\n description: opaque cursor from the previous page' > ~/api/openapi/pagination.yaml
  2. 3 locked · each failed submit reveals one

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list