REST APIs in Depth · Capstone
Capstone: Review a Flawed API
Find and fix the design problems in an existing API.
Scenario
You are asked to review this API before it goes public:
GET /getUsers?page=1000&size=100000returns{"success": true, "data": [...]}POST /users/delete?id=7GET /users/7/activateactivates a user- Errors:
200 OK {"success": false, "message": "User not found"} - Dates:
"created": "10/09/2026 14:00"; prices:"price": 19.99 - Updates:
PUT /users/7with only the changed fields
Requirements
- Identify every issue and its impact
- Propose the corrected design
- Prioritize fixes for launch
Constraints
- Launch in 3 weeks
- Existing internal clients must keep working during migration
Deliverables
- List the problems in this API and why each matters.
- Propose the corrected endpoints and a migration plan.
Draft each deliverable below before revealing the model answer and rubric.
Further reading: Zalando RESTful API Guidelines
Deliverables
List the problems in this API and why each matters.
Model answer
- Verbs in URLs (
/getUsers,/users/delete) and state change via GET (/activate) — breaks HTTP semantics; crawlers/prefetch can activate users. - Unbounded page size and deep OFFSET pagination — DoS risk and slow queries.
- Errors returned as 200 — breaks retries, monitoring, caches and SDKs.
- Ambiguous dates without timezone; floats for money — data corruption.
- PUT used as partial update — wipes omitted fields.
- Envelope with
successflag duplicates HTTP status.
Rubric
A strong review explains the impact (security, reliability, client breakage), not just style. Bonus: missing auth/rate limiting, enumerable IDs, no versioning/deprecation plan.
Propose the corrected endpoints and a migration plan.
Model answer
GET /v1/users?limit≤100&cursor=→{"items": [], "next_cursor": ...}DELETE /v1/users/{id}→ 204;POST /v1/users/{id}:activate→ 200PATCH /v1/users/{id}with JSON Merge Patch;PUTonly for full replacement- Problem Details errors with correct 4xx/5xx codes
- RFC 3339 UTC timestamps; money as
{amount, currency}minor units - Migration: ship
/v1alongside legacy routes; legacy routes returnDeprecation/Sunsetheaders; track usage per client; remove after sunset
Rubric
Look for a realistic migration (parallel run, telemetry, deadlines) rather than a breaking big-bang change.
Open in the app to mark lessons complete, take notes and track your progress.