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.

EasyTechnical
68 practiced

For each of GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS, state whether it is safe, whether it is idempotent, and whether it is cacheable, then give a short example endpoint where using the wrong method caused a real bug (for instance, a client retry duplicating a purchase, or a caching layer serving a stale response for a method it should not have cached).

EasyTechnical
70 practiced

Implement a POST /tasks endpoint (Node.js with Express) that accepts JSON {title, dueDate}, validates that title is non-empty, persists the task to an in-memory store, and returns 201 Created with a Location header pointing at /tasks/{id} and the new task's id in the body. Handle malformed JSON and validation failures with an appropriate 4xx response.

MediumSystem Design
77 practiced

Design the REST API for a data-enrichment microservice that multiple downstream teams will call, needing to sustain 1,000 requests per second at a P95 latency target of 200 milliseconds. Specify the endpoints and request/response contract, your idempotency approach for retried writes, your error model, and how you version the contract as the enriched schema evolves. Sketch, at a high level, how you would validate the design can actually sustain that load.

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.

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?

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.