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.

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.

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?

HardTechnical
58 practiced

A client reports getting inconsistent data back when they retried a POST that was supposed to be idempotent. Walk through how you would investigate: what you check first in the idempotency store, the database's unique constraints, and the request logs, and what root causes you would rule in or out (a race condition between two concurrent requests with the same key, a missing unique constraint, or a malformed or reused idempotency key). What change would you make afterward to prevent a recurrence?

HardTechnical
68 practiced

HTTP/2 and HTTP/3 change some of the assumptions REST API design grew up under: request multiplexing over one connection, header compression, and (in HTTP/3) a transport built on QUIC instead of TCP. What actually changes for a REST API's design and operations when you move from HTTP/1.1 to HTTP/2 or HTTP/3, for example does the old advice to avoid too many small requests still apply, and what should change in your load-balancing and CDN configuration?

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.

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.