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
65 practiced

REST requires the server to hold no client session state between requests. Explain what statelessness does and does not forbid (a server may still hold data about the resource itself, just not about a specific client's conversation), and describe two concrete techniques for handling per-user needs like login sessions without server-side session state. What does statelessness buy you operationally when traffic spikes and an instance needs to be replaced, and what do you give up?

MediumSystem Design
57 practiced

Model the resources and endpoints for an order-management API where an order moves through created, paid, shipped, and cancelled states. Decide how you represent the state transitions themselves: separate action endpoints like POST /orders/{id}/ship and POST /orders/{id}/cancel, or a single PATCH to a status field, and explain the trade-off between the two in terms of URL complexity, discoverability, and what happens when a client tries an invalid transition (for example cancelling an order that already shipped).

HardSystem Design
72 practiced

A user's feed is assembled by joining across their followers' posts, and the result set is large enough that naive joins would be N+1 queries. Design a cursor pagination scheme for this feed that avoids N+1 queries, keeps the cursor compact and opaque to the client, and remains correct while new posts are constantly being added. Also describe how you would sign or encode the cursor so a client cannot tamper with it to page into data outside their access, and how you would version the cursor format so a future schema change does not break old cursors already in a client's hands.

MediumTechnical
83 practiced

Explain how Cache-Control, ETag, Last-Modified, and Vary work together to let a client avoid re-downloading a resource it already has. Walk through the exact sequence of headers exchanged on a cache hit versus a cache miss for a GET request, and say when you would reach for stale-while-revalidate instead of a hard max-age.

MediumSystem Design
67 practiced

Design the REST endpoints for a Book resource that also has nested Reviews belonging to it: list, get one, create, update, and delete a book, plus list and add reviews for a book. For each endpoint give the HTTP method, the canonical path, the expected request body where relevant, and the success status code. How do you keep the response shape for the list endpoint from triggering an N+1 query when reviews are included, and how does pagination interact with the nested collection?

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.