RESTful API Design Questions

Designing resource-oriented HTTP APIs following REST constraints: resource modeling, URI structure, correct use of HTTP methods, statelessness, and HATEOAS trade-offs. Covers naming conventions, collection vs. singleton resources, filtering/sorting/pagination, and choosing appropriate status codes. The default paradigm most interview questions in this category probe.

MediumTechnical
70 practiced

Implement an idempotent POST /orders endpoint (Python, Flask or FastAPI) that reads an Idempotency-Key header and uses it to prevent duplicate order creation when a client retries. Show the database schema you would use to store keys against their result, the transaction boundaries, and what the server returns when a second request arrives with the same key while the first one is still being processed.

HardTechnical
64 practiced

Implement PATCH /users/{id} (Python, Flask) that accepts a JSON Merge Patch body, supports optimistic concurrency via an If-Match header carrying an ETag, returns 412 Precondition Failed on a mismatch, validates the incoming fields, and returns 200 with the updated resource on success. You may assume helper functions get_user, save_user, and compute_etag already exist.

HardSystem Design
78 practiced

Design a shared idempotency-key service that several backend services can call to make their own POST endpoints safely retryable, rather than every team building its own key store. Cover the storage schema, the TTL policy, what happens on a key collision from two different request bodies, the consistency guarantee you offer callers, and how the service scales to thousands of checks per second without becoming a single point of failure.

MediumTechnical
65 practiced

Design a JSON error response schema that both your internal teams and external clients will consume: what fields would you include (for example a machine-readable code, a human message, field-level validation detail, and a correlation id for tracing), what belongs in the client response versus only in your logs, and how would a client tell a retryable error from one it should not retry?

EasyTechnical
67 practiced

What conventions do you use for naming REST resources and endpoints: plural versus singular nouns, when to nest a resource under its parent (for example /users/{userId}/orders) versus keep it top-level, how to represent an action that is not plain CRUD without falling back to an RPC-style verb in the URL, and how you keep the number of endpoints from exploding as relationships between resources grow.

Unlock Full Question Bank

Get access to all 39 RESTful API Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.