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.
Design a REST API for a long-running bulk job (for example a bulk data export) that must support submit, status polling, pause, resume, and cancel, plus resuming correctly after a failure. Define the job's state machine and which transitions are valid from which states, ensure operations stay idempotent under retries, and describe what the client-visible progress and error model looks like.
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).
Show what a JSON response for an order resource would look like if it included hypermedia links for the actions currently available on it (for example pay, cancel, and view items). Explain what HATEOAS is supposed to buy a client that the links alone would not otherwise know, and give the concrete reason most public REST APIs today skip full hypermedia even though the specification recommends it.
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.
A REST API needs to serve both JSON and XML from the same endpoint. Explain how the Accept and Content-Type headers let the client and server agree on a representation, what the server should do when a client's Accept header cannot be satisfied, and when you would reach for content negotiation instead of a separate versioned endpoint to change serialization later.
Unlock Full Question Bank
Get access to all 33 RESTful API Design interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.