API Design
Studies in this cluster, in series order. Each one keeps its own URL.
APIs
HTTP semantics, retries, idempotency, GraphQL tradeoffs, and contract design.
API Design
6 studies- 1.API Design — Naming, Paths, Routing & ContractsInterviewers rarely ask you to design REST. They ask whether /getUser is wrong, how deep nesting should go, when to version, which status codes clients can trust, and how you paginate without breaking caches. This hub maps naming, nesting, methods/status, versioning, and list contracts.
- 2.Resource Naming & URI Design — Plurals, Case, IDs & CollectionsAlmost every API design interview starts with a path sketch. Interviewers check plural nouns, verbs smuggled into URLs, kebab vs snake consistency, opaque IDs, and whether filters live in the query string. We design the nouns idempotent retries operate on — without re-teaching Idempotency-Key.
- 3.Path Nesting, Routing & Actions — Depth Limits & Sub-resourcesNesting feels natural until clients need cross-org search, gateways rewrite paths, or authz must check every segment. Cap depth around 2–3 resource pairs, keep a canonical item URL, and model non-CRUD verbs as :customAction or /actions — not controller soup.
- 4.HTTP Methods & Status Codes for Resource APIsInterviewers expect CRUD mapped to methods and status codes clients can automate on. Always-200 with {success:false} is a classic fail. This lesson covers GET/POST/PUT/PATCH/DELETE, 201 Location, Prefer, If-Match, and the 4xx grid — pointing POST retries and 429 at the Idempotency and rate-limit docs.
- 5.API Versioning Strategies — URL, Header & Query TradeoffsShould we put /v1 in the path is a classic interview trap. Prefer additive, non-breaking evolution; version only when you must break contracts; then compare URL vs media-type/header vs query (api-version=) with Sunset and a migration window.
- 6.Pagination, Filtering, Sorting & Partial ResponsesList endpoints make or break API UX. Interviewers ask offset vs cursor, why page 50 drifts under inserts, how to sort stably, where filters live, and whether fields= helps mobile. Prefer cursors for large append-heavy feeds; always define a total order.