Backend & APIs

REST API Design interview questions

Interviewers probe for a candidate's ability to design intuitive, scalable, and maintainable APIs that adhere to REST principles, ensuring good developer experience and efficient data exchange. They look for understanding of core HTTP concepts, resource modeling, and practical considerations like versioning and error handling.

14 questions (4 easy · 6 medium · 4 hard), each with what a strong answer covers and where people lose the point. Free to read, no account.

On this page (14 questions)
  1. 1.What are the core principles of REST, and why are they important for API design?
  2. 2.How do HTTP methods (GET, POST, PUT, PATCH, DELETE) map to CRUD operations in a RESTful API? Provide an example for each.
  3. 3.Explain the best practices for naming resources and designing URIs in a REST API. Provide examples of good and bad URI designs.
  4. 4.When would you use a 200 OK, 201 Created, or 204 No Content HTTP status code? Provide a scenario for each.
  5. 5.Explain the difference between PUT and PATCH methods in REST, including their idempotency characteristics. When would you choose one over the other?
  6. 6.How would you design a consistent error response structure for a REST API? What information should it include?
  7. 7.Discuss different strategies for API versioning and their pros and cons. Which strategy do you prefer and why?
  8. 8.How would you implement pagination for a collection resource in a REST API? Describe common approaches and their parameters.
  9. 9.When is it appropriate to use nested resources in a URI, and provide an example? What are the potential downsides of deep nesting?
  10. 10.Define idempotency and safety in the context of HTTP methods. Which standard HTTP methods are safe, and which are idempotent?
  11. 11.Explain the concept of HATEOAS (Hypermedia as the Engine of Application State) in REST. What are its benefits and challenges?
  12. 12.Discuss the role of an API Gateway in a microservices architecture and how it relates to REST API design. What functionalities does it typically provide?
  13. 13.Compare and contrast REST with GraphQL. In what scenarios would you prefer one over the other for API design?
  14. 14.How would you design and implement rate limiting for a public REST API? What are the key considerations?

1.What are the core principles of REST, and why are they important for API design?

Warm-up

What a strong answer covers

  • List and briefly explain the six architectural constraints of REST (Client-Server, Stateless, Cacheable, Uniform Interface, Layered System, Code-On-Demand).
  • Emphasize the Uniform Interface constraint as central to REST's benefits.
  • Discuss how these principles contribute to scalability, simplicity, modifiability, and independent evolution of client/server.
  • Mention resources as the key abstraction and how HTTP methods are used to manipulate them.

Where people lose the point

  • Confusing REST with a protocol or specific technology rather than an architectural style.
  • Omitting key constraints or misinterpreting their meaning (e.g., statelessness).
  • Failing to connect the principles to tangible benefits for API design.
Link to this question

2.How do HTTP methods (GET, POST, PUT, PATCH, DELETE) map to CRUD operations in a RESTful API? Provide an example for each.

Warm-up

What a strong answer covers

  • Map GET to Read, POST to Create, PUT to Update (full replacement), PATCH to Update (partial modification), and DELETE to Delete.
  • Provide a clear URI example for each operation on a hypothetical resource (e.g., `/products`).
  • Briefly explain the expected request/response for each method (e.g., POST expects a body, GET returns a body).
  • Mention idempotency and safety where relevant for PUT/PATCH/GET/DELETE.

Where people lose the point

  • Confusing PUT and PATCH, or using PUT for partial updates.
  • Using POST for updates when PUT/PATCH would be more appropriate.
  • Providing examples that use verbs in URIs (e.g., `/createProduct`).
Link to this question

3.Explain the best practices for naming resources and designing URIs in a REST API. Provide examples of good and bad URI designs.

Warm-up

What a strong answer covers

  • Emphasize using nouns (plural for collections, singular for items) instead of verbs in URIs.
  • Explain how to represent relationships using nested resources (e.g., `/users/{id}/orders`).
  • Discuss the role of query parameters for filtering, sorting, and pagination, not for resource identification.
  • Provide examples of well-designed URIs (e.g., `/products`, `/products/123`) and poorly designed ones (e.g., `/getAllProducts`, `/getProduct?id=123`).

Where people lose the point

  • Suggesting verbs in URIs (e.g., `/deleteUser`).
  • Using query parameters for unique resource identification.
  • Creating overly deep or complex nested URI structures.
Link to this question

4.When would you use a 200 OK, 201 Created, or 204 No Content HTTP status code? Provide a scenario for each.

Warm-up

What a strong answer covers

  • 200 OK: Explain its use for successful GET, PUT, PATCH, DELETE operations where a response body is returned.
  • 201 Created: Describe its use for successful POST operations that result in the creation of a new resource, including the `Location` header.
  • 204 No Content: Explain its use for successful operations (e.g., DELETE, PUT) where no response body is expected or needed.
  • Provide a concrete example scenario for each status code in an API context.

Where people lose the point

  • Using 200 OK for resource creation instead of 201 Created.
  • Returning a response body with a 204 No Content status.
  • Not mentioning the `Location` header for 201 Created responses.
Link to this question

5.Explain the difference between PUT and PATCH methods in REST, including their idempotency characteristics. When would you choose one over the other?

Core

What a strong answer covers

  • Define PUT as a method for complete replacement of a resource or creation if it doesn't exist, requiring the full resource representation.
  • Define PATCH as a method for partial modification of a resource, sending only the changes.
  • Explain that both PUT and PATCH are idempotent, meaning multiple identical requests have the same effect as a single one.
  • Discuss scenarios for choosing PUT (full replacement, idempotent creation) vs. PATCH (partial updates, less bandwidth for large resources).

Where people lose the point

  • Confusing PUT with PATCH, especially regarding partial updates.
  • Incorrectly stating that PATCH is not idempotent.
  • Failing to explain the 'full replacement' aspect of PUT.
Link to this question

6.How would you design a consistent error response structure for a REST API? What information should it include?

Core

What a strong answer covers

  • Emphasize using appropriate HTTP status codes (4xx for client errors, 5xx for server errors).
  • Propose a consistent JSON structure for error responses (e.g., `{'error': {'code': '...', 'message': '...', 'details': [...]}}`).
  • Detail the information to include: a machine-readable error code, a human-readable message, and optional specific field errors or additional context.
  • Discuss avoiding exposure of sensitive internal server details and providing actionable error messages.

Where people lose the point

  • Returning 200 OK for error conditions.
  • Providing inconsistent or unstructured error responses.
  • Exposing stack traces or overly technical internal details in public error messages.
Link to this question

7.Discuss different strategies for API versioning and their pros and cons. Which strategy do you prefer and why?

Core

What a strong answer covers

  • Describe URI versioning (e.g., `/v1/products`), including its pros (discoverability, cacheability) and cons (URI pollution, routing complexity).
  • Describe Header versioning (e.g., `Accept: application/vnd.myapi.v1+json`), including its pros (clean URIs) and cons (less discoverable, browser tooling issues).
  • Describe Query Parameter versioning (e.g., `/products?version=1`), including its pros (easy to implement) and cons (cacheability issues, not truly RESTful).
  • State a preferred strategy and justify the choice based on factors like ease of use, discoverability, and impact on clients.

Where people lose the point

  • Only mentioning one versioning strategy.
  • Not discussing the trade-offs (pros and cons) of each strategy.
  • Failing to justify a preferred strategy with sound reasoning.
Link to this question

8.How would you implement pagination for a collection resource in a REST API? Describe common approaches and their parameters.

Core

What a strong answer covers

  • Explain the need for pagination to handle large datasets and improve performance.
  • Describe offset-based pagination (e.g., `?offset=0&limit=10`), including its pros (simple) and cons (performance issues with large offsets, unstable with insertions/deletions).
  • Describe cursor-based pagination (e.g., `?after=cursor_value&limit=10`), including its pros (more stable, better performance for large datasets) and cons (more complex to implement, requires ordered data).
  • Discuss including pagination metadata in the response (e.g., total count, next/prev links).

Where people lose the point

  • Only describing one pagination method.
  • Not discussing the trade-offs or specific use cases for each method.
  • Forgetting to mention the importance of metadata or links for navigation.
Link to this question

9.When is it appropriate to use nested resources in a URI, and provide an example? What are the potential downsides of deep nesting?

Core

What a strong answer covers

  • Explain that nested resources represent a clear parent-child or ownership relationship (e.g., an order belonging to a user).
  • Provide a concrete example like `/users/{userId}/orders` or `/books/{bookId}/chapters`.
  • Discuss the benefits: clear hierarchy, improved readability, and logical grouping of related resources.
  • Detail the downsides of deep nesting: long and complex URIs, increased coupling, and potential for performance issues if not carefully designed.

Where people lose the point

  • Using nested resources for unrelated entities.
  • Failing to provide a clear example of appropriate nesting.
  • Not addressing the potential problems associated with excessive nesting.
Link to this question

10.Define idempotency and safety in the context of HTTP methods. Which standard HTTP methods are safe, and which are idempotent?

Core

What a strong answer covers

  • Define 'safety': a method is safe if it does not alter the state of the server (e.g., GET, HEAD, OPTIONS).
  • Define 'idempotency': a method is idempotent if multiple identical requests have the same effect on the server as a single request (e.g., GET, HEAD, OPTIONS, PUT, DELETE).
  • List which standard HTTP methods fall into each category, explaining why (e.g., POST is neither safe nor idempotent).
  • Provide brief examples to illustrate the concepts for each method.

Where people lose the point

  • Confusing safety with idempotency.
  • Incorrectly classifying POST as idempotent or safe.
  • Failing to explain the practical implications of these properties for API clients.
Link to this question

11.Explain the concept of HATEOAS (Hypermedia as the Engine of Application State) in REST. What are its benefits and challenges?

Hard

What a strong answer covers

  • Define HATEOAS as a constraint of the Uniform Interface, where responses include links to related resources and available actions.
  • Explain how HATEOAS allows clients to navigate the API dynamically without prior knowledge of URIs, making the API self-discoverable.
  • Discuss benefits: improved evolvability (clients are less coupled to URI structures), better discoverability, and a more truly RESTful architecture.
  • Detail challenges: increased complexity for both server (generating links) and client (parsing links), potential for verbose responses, and difficulty in widespread adoption.

Where people lose the point

  • Misinterpreting HATEOAS as simply including links, rather than driving application state.
  • Failing to explain how HATEOAS reduces client-server coupling.
  • Not addressing the practical difficulties and overhead of implementing HATEOAS.
Link to this question

12.Discuss the role of an API Gateway in a microservices architecture and how it relates to REST API design. What functionalities does it typically provide?

Hard

What a strong answer covers

  • Define an API Gateway as a single entry point for all clients, abstracting the underlying microservices.
  • Explain its role in simplifying client interactions with complex microservice deployments.
  • List key functionalities: request routing, composition/aggregation, authentication/authorization, rate limiting, caching, logging/monitoring, protocol translation.
  • Relate these functionalities to REST API design principles, such as providing a uniform interface and handling cross-cutting concerns.

Where people lose the point

  • Confusing an API Gateway with a load balancer or a simple proxy.
  • Failing to list a comprehensive set of functionalities.
  • Not connecting the API Gateway's role back to the benefits for REST API consumers or designers.
Link to this question

13.Compare and contrast REST with GraphQL. In what scenarios would you prefer one over the other for API design?

Hard

What a strong answer covers

  • Describe REST's resource-oriented approach, multiple endpoints, and reliance on HTTP methods/status codes.
  • Describe GraphQL's single endpoint, query language for data fetching, and ability for clients to request specific data.
  • Compare key differences: data fetching (over-fetching/under-fetching vs. precise fetching), number of endpoints, versioning, caching, error handling.
  • Discuss scenarios for REST (simpler APIs, public APIs, caching benefits, traditional web apps) vs. GraphQL (complex data graphs, mobile apps, microservices aggregation, client-driven data needs).

Where people lose the point

  • Presenting GraphQL as a direct replacement for REST in all scenarios.
  • Failing to highlight the core architectural differences (resource-oriented vs. graph-oriented).
  • Not providing clear use cases where each technology excels.
Link to this question

14.How would you design and implement rate limiting for a public REST API? What are the key considerations?

Hard

What a strong answer covers

  • Explain the purpose of rate limiting: preventing abuse, ensuring fair usage, protecting resources, and maintaining API stability.
  • Describe common algorithms: fixed window, sliding window log, sliding window counter, token bucket, leaky bucket.
  • Discuss key considerations: identifying clients (IP address, API key, authenticated user), defining limits (requests per second/minute/hour), handling exceeded limits (429 Too Many Requests status code), and communicating limits (HTTP headers like `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`).
  • Mention implementation aspects like distributed counters, caching, and edge cases.

Where people lose the point

  • Only mentioning the 'what' (rate limiting exists) without the 'how' (algorithms, implementation details).
  • Forgetting to mention the HTTP status code for rate limit exceeded (429).
  • Not discussing how to communicate rate limits to clients via headers.
Link to this question
No account needed

Answer one real REST API Design question now

A question a REST API Design panel actually asks, answered out loud, scored on what you said and how you said it. Under two minutes, and nothing to sign up for.

What are the core principles of REST, and why are they important for API design?

We never store the audio. Your answer is deleted within 24 hours unless you save the result.

How REST API Design answers get judged

The weights a REST API Design interviewer is holding, whether or not they say so out loud. Round Zero scores your practice answers against exactly these, and quotes your own words back as the evidence for each.

Conceptual Understanding

30%

Demonstrates a deep understanding of REST principles, HTTP semantics, and architectural patterns.

Practical Application

30%

Ability to translate theoretical knowledge into practical, well-reasoned API design choices for various scenarios.

Adherence to Design Principles

25%

Applies best practices for URI design, resource modeling, error handling, and versioning, showing awareness of trade-offs.

Communication Clarity

15%

Articulates complex concepts clearly, concisely, and logically, providing relevant examples.

Role tracks that include REST API Design

Related Backend & APIs skills

All skills →

Now say them out loud

You have read what strong REST API Design answers contain. The next thing that moves the needle is producing one under time, out loud, and finding out where it falls apart.

  • These questions asked back, with follow-ups
  • Flashcards for the ones you keep missing
  • A scored mock that quotes your own answers

Browse every skill

Practising REST API Design: common questions

What REST API Design interview questions should I practice?
Start with the core areas REST API Design interviewers probe: What are the core principles of REST, and why are they important for API design; How do HTTP methods (GET, POST, PUT, PATCH, DELETE) map to CRUD operations in a RESTful API? Provide an example for each.; Explain the best practices for naming resources and designing URIs in a REST API. Provide examples of good and bad URI designs.. This page outlines strong answers and common mistakes, and the scored path drills each one with follow-ups.
Is the REST API Design practice free?
Yes. The REST API Design path runs free inside Round Zero: lessons, practice questions and flashcards. Drills are unlimited on every plan, free included. So is the full scorecard. Free also covers 3 complete scored interviews, no card.
How is this different from a REST API Design question list?
A static list gives you questions with no feedback. Round Zero runs a live scored practice that probes your actual answers, rotates difficulty, and tells you exactly what to fix, grounded in a REST API Design rubric.
How should I prepare for a REST API Design interview?
Learn the concepts, drill the questions until answers come fast, then prove it in a scored mock. Round Zero sequences all three so you know you are ready, not just that you read about REST API Design.
How is a REST API Design answer scored?
REST API Design answers are scored on conceptual understanding, practical application, adherence to design principles, communication clarity, with evidence quoted from what you actually said, so feedback is specific instead of generic praise.