InterviewStack.io LogoInterviewStack.io

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.

HardSystem Design
65 practiced

Design a globally distributed, read-heavy product catalog API: writes happen centrally in one region, but reads need to be fast for users worldwide via regionally replicated caches. What does your API contract need to expose so clients understand the consistency they are getting (for example, how fresh a read might be after a recent write in another region), and how do you invalidate the regional caches when the central write happens?

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).

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.

EasyTechnical
80 practiced

You are designing the error handling for an API. Pick the single most appropriate HTTP status code, and briefly justify it, for each of: malformed JSON in the request body, a validation error on a business rule, an authentication failure, an authorization failure, a request for a resource that does not exist, a request accepted for asynchronous processing, and a successful resource creation versus a successful update with no content to return. Name one common mistake engineers make on at least two of these.

EasyTechnical
66 practiced

For a public partner API, an internal high-throughput service mesh, and a mobile client on unreliable networks, would you reach for REST, GraphQL, or gRPC? Compare the three on caching, client flexibility, network overhead, versioning, and developer ergonomics, and justify a different choice (or the same one) for each of the three scenarios.

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.