REST API Interview Questions

Reviewed by Mark Dickie · Last updated

13 questions on this page you can answer and see marked on the spot. Go to the first one

REST is an architectural style for distributed hypermedia systems, defined by Roy Fielding in 2000, that uses HTTP as its application protocol. A REST API exposes resources as URIs, represents them with formats like JSON or XML, and applies a uniform set of HTTP verbs so clients and servers can evolve independently. For interviews, you should know the six constraints of REST, which HTTP methods are safe versus idempotent, when to use which status code, and how content negotiation and HATEOAS fit into a well-designed API.

What does a REST API interview test?

Interviewers check whether you can design a resource model and map operations onto HTTP correctly, not just whether you can define the acronym. Expect questions on method semantics (GET vs PUT vs PATCH), status code selection, idempotency guarantees, and the difference between REST and RPC-style APIs. You may also be asked to spot violations of statelessness or explain when REST is a poor fit (e.g., real-time streaming, where WebSockets or gRPC make more sense).

HTTP MethodSafeIdempotentTypical Use
GETYesYesRetrieve a resource representation
POSTNoNoCreate a resource or trigger an action
PUTNoYesReplace a resource at a known URI
PATCHNoNo (by default)Apply a partial update
DELETENoYesRemove a resource

What are the six constraints of REST?

Fielding's dissertation defines six constraints. An API that satisfies all of them is considered RESTful; one that drops HATEOAS is often called "REST-ish" in practice.

  1. Client–server separation — UI concerns stay in the client; data storage stays in the server. The two can evolve and scale independently.
  2. Statelessness — Each request contains everything the server needs to handle it. No session state is stored on the server between requests.
  3. Cacheability — Responses label themselves as cacheable or not, letting clients and intermediaries reuse data and cut latency.
  4. Uniform interface — Resources are identified by URIs, manipulated through representations, and acted on with a consistent set of self-descriptive HTTP methods.
  5. Layered system — A client cannot tell whether it is talking to the origin server or an intermediary (proxy, load balancer, gateway).
  6. Code on demand (optional) — Servers can extend client behavior at runtime by sending executable code such as JavaScript.

Key facts

  • Tarmac has 30 HTTP & APIs interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
  • Tarmac tracked 2,644 job postings asking for HTTP & APIs in September 2026.
  • Roles asking for HTTP & APIs advertise a median base salary of US$165,000, across 867 job postings as of September 2026.
  • Tarmac last reviewed these HTTP & APIs interview questions on 13 October 2026.

At a glance

Questions25 shown · 30 in the bank
Difficulty1–5 of 5
FormatsMultiple choice, Short answer, True / false, Fill in the blank, Ordering, Flashcard

What you'll review

  1. rest principles

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

Which HTTP method is conventionally used to create a new resource in a RESTful API?#

Options

Show answer

POST is the HTTP method conventionally used to create a new resource in a RESTful API. The client sends the representation to a collection URI, and the server assigns the new resource's identifier, usually replying with 201 Created and a Location header. GET, DELETE, and HEAD do not create resources.

Why:

In REST conventions, POST is the method used to create a new resource: the client sends the representation to a collection URI and the server assigns the identifier of the new resource. GET retrieves representations, DELETE removes a resource, and HEAD returns only the headers that GET would return, with no body. None of those three is the conventional choice for creating a resource.

Which REST architectural constraint requires that every request from a client to the server must contain all the information needed to understand and process the request, without relying on stored server-side session state?#

Show answer

Statelessness requires every client request to be fully self-contained so the server never keeps session state between requests; the client supplies all context each time.

Why:

Statelessness is the REST constraint that requires each request to carry all the information needed to process it, so the server does not rely on session state stored from earlier requests. Other constraints in Fielding's set address different concerns, such as the separation of client and server responsibilities, layering of intermediaries, caching, and optional code delivery, and none of them governs whether the server holds session state. The correct answer is therefore statelessness.

What does the REST constraint HATEOAS stand for, and what does it require a response to include?#

Show answer

HATEOAS stands for Hypermedia As The Engine Of Application State. It requires that API responses include hypermedia links that tell the client what actions are available next, so the client can navigate the API dynamically rather than hard-coding URLs.

Why:

HATEOAS is an acronym for Hypermedia As The Engine Of Application State, a constraint of REST. It requires responses to embed hypermedia links that describe the actions and resources reachable from the current state, which lets the client discover next steps at runtime instead of hard-coding endpoint URLs.

What does the acronym REST stand for in the context of web APIs?#

Show answer

Representational State Transfer

Why:

REST stands for Representational State Transfer, an architectural style for distributed hypermedia systems introduced by Roy Fielding in his 2000 doctoral dissertation. It defines a set of constraints (client-server, statelessness, cacheability, uniform interface, layered system, and code-on-demand) that APIs may follow to be considered RESTful.

In a RESTful architecture, the server is required to maintain session state between client requests. True or false?#

Options

Show answer

No. REST requires statelessness, so a server in a RESTful architecture must not store client session state between requests. Each request has to carry all the information needed to process it, such as in headers, query parameters, or the body. This lets any server instance handle any request, which supports scalability.

Why:

False. REST is stateless by design: one of its architectural constraints is that the server must not store client-specific session state between requests. Each request must be self-contained and carry all the context the server needs, such as in headers, query parameters, or the body. Because no server holds session data, any server instance can handle any request, which supports scalability.

True or false: In REST, statelessness means the server must not store any client session state between requests, and each client request must contain all the information the server needs to understand and process it.#

Options

Show answer

True. Statelessness is a core REST constraint: the server stores no client session state between requests, so every request must carry all the information needed to process it. Because any server instance can handle any request, this design improves scalability and reliability.

Why:

Statelessness is one of the architectural constraints Roy Fielding defined for REST. The server handles each request independently, without relying on session or application state stored from earlier requests, so each request must be self-describing. This improves scalability and reliability because any server instance can handle any request.

In REST, the HTTP methods GET, PUT, and DELETE are _____, meaning that issuing the same request multiple times produces the same effect as issuing it once. The POST method is not — each call may create a new resource or trigger a distinct side effect.#

Show answer

In REST, the HTTP methods GET, PUT, and DELETE are idempotent, meaning that issuing the same request multiple times produces the same effect as issuing it once. The POST method is not — each call may create a new resource or trigger a distinct side effect.

Why:

Idempotency is a key property in REST. GET, PUT, and DELETE are idempotent HTTP methods: repeated identical calls have the same effect as a single call. POST is intentionally not idempotent because it is used to create new resources or trigger non-repeatable actions, so each call can produce a distinct result.

Which of the following is not one of the architectural constraints that define REST as originally described by Roy Fielding?#

Options

Show answer

Distributed transactions are not one of the architectural constraints that define REST as Roy Fielding originally described it. Fielding's constraints are client–server separation, statelessness, cacheability, uniform interface, layered system, and optional code on demand. Distributed transactions are a data-consistency mechanism, not an architectural style constraint.

Why:

Fielding's dissertation defines REST through a set of architectural constraints: client–server separation, statelessness, cacheability, a uniform interface, a layered system, and the optional code on demand. Client–server separation, statelessness, and cacheable responses are all on that list, so they are not the answer. Distributed transactions are a data-consistency and coordination mechanism (for example two-phase commit) that is not part of the REST architectural style, which makes it the option that does not belong.

Which statement best describes the statelessness constraint of REST as defined by Roy Fielding?#

Options

Show answer

Statelessness in REST, as Roy Fielding defined it, means each client request must carry all the information the server needs to process it, so the server keeps no session state between requests. Any needed state, such as an authentication token, is sent by the client each time. This lets any server instance handle any request, which improves scalability and reliability.

Why:

Fielding's statelessness constraint requires that every client request be self-contained, carrying all the information the server needs to understand and process it, so the server retains no conversational context between requests. The distractors describe server-side sessions or identifier-based lookups, which are exactly the stored state statelessness forbids, and a persistent connection that the server uses to track a conversation, which is also server-held context. This self-contained design lets any server instance handle any request, improving scalability and reliability.

The Richardson Maturity Model defines four levels of RESTfulness for an HTTP API. Order the four levels from least RESTful (Level 0) to most RESTful (Level 3).#

Put these in order

Show answer

The Richardson Maturity Model progresses from plain RPC, through individual resources with distinct URIs and correct HTTP verbs and status codes, to HATEOAS at the top level. Each level adds one more REST constraint on top of the previous one, so the order is strict and cumulative.

Why:

The Richardson Maturity Model, introduced by Leonard Richardson, describes four levels of REST maturity. Level 0 is plain RPC over HTTP: a single endpoint (often POST) carries method names and arguments in the body, and the protocol is used merely as a transport. Level 1 introduces resource orientation: each noun gets its own distinct URI, but the API still typically uses a single verb such as POST for all actions. Level 2 adds correct use of HTTP verbs (GET, PUT, POST, DELETE, PATCH) and standard HTTP status codes, so the protocol's semantics are respected. Level 3 adds HATEOAS, where responses include hypermedia links that guide the client to the next valid actions, decoupling the client from hardcoded URIs. Each level builds on the previous one, so the correct order from least to most RESTful is plain RPC, distinct resource URIs, correct verbs and status codes, then HATEOAS.

In a REST API, which HTTP method is both safe (causes no server-side side effects) and idempotent (repeating the same request produces the same result as sending it once)?#

Options

Show answer

GET is the HTTP method that is both safe and idempotent. It is read-only, so it causes no server-side side effects, and repeating the same GET request returns the same representation without changing state. POST is neither safe nor idempotent, while PUT and DELETE are idempotent but not safe.

Why:

GET is the method that is both safe and idempotent under RFC 7231. It is defined as a read-only retrieval that must not modify server state, so it is safe. Repeating the same GET returns the same representation without further change, so it is idempotent. The other methods each fail at least one property: POST is neither safe nor idempotent because it typically creates new resources on each call, while PUT and DELETE are idempotent (repeating them leaves the same final state) but not safe, because they modify server state.

The Richardson Maturity Model describes four levels of RESTfulness for HTTP APIs. Order the levels from least RESTful (Level 0) to most RESTful (Level 3).#

Put these in order

Show answer

The Richardson Maturity Model orders REST maturity from Level 0 (plain RPC over a single URI and method) to Level 1 (separate resource URIs), Level 2 (proper HTTP verbs and status codes), and Level 3 (hypermedia controls, or HATEOAS, where responses link to the next valid actions). Each level adds one more layer of REST conformance on top of the previous one.

Why:

The model builds up in layers. Level 0 tunnels every operation through one URI and typically one verb, as in RPC. Level 1 splits the API into multiple resource URIs, one per entity. Level 2 adds the correct HTTP verbs and status codes so that the uniform interface is used properly. Level 3 adds hypermedia controls (HATEOAS), so responses tell the client which actions are available next. Each level builds on the one below it, so the order is strictly from Level 0 to Level 3.

In REST, the uniform interface constraint includes four sub-constraints. One of them is HATEOAS (Hypermedia As The Engine Of Application State). Briefly describe what HATEOAS means and give a concrete example.#

Show answer

HATEOAS means that REST responses embed hypermedia links the client can follow to discover the next valid actions, rather than the client hard-coding URIs — the hypermedia in the response drives the application state transitions. For example, a GET /orders/123 response might include a _links object with rel: 'payment' → /orders/123/payment and rel: 'cancel' → /orders/123/cancel; the client reads these links dynamically and follows them without knowing the URL structure in advance.

Why:

The back directly describes HATEOAS — responses carry hypermedia links that tell the client what actions are available next, so the client need not hard-code URI patterns — and then gives a concrete example: a GET /orders/123 response whose _links object exposes payment and cancel relation links the client follows dynamically. This matches the prompt's two explicit requirements: a brief description and a concrete example.

What does the statelessness constraint of REST require?#

Options

Show answer

Statelessness requires that each request contains all the information needed to process it, with the server keeping no client session state between requests. Because every request is self-contained (carrying its own auth token, for example), any server instance can handle any request, which makes horizontal scaling and load balancing straightforward. It says nothing about persistent application data, which servers do store.

Why:

Statelessness means no client session context is stored on the server between requests — each request is self-contained (e.g. carries its own auth token), which is what lets any server instance handle any request and makes horizontal scaling and load balancing straightforward. It says nothing about persistent application data, which servers absolutely do store.

Name and briefly explain two of the architectural constraints that define a RESTful API.#

Show answer

Statelessness: every request carries all the context the server needs, so the server keeps no per-client session between requests, which makes the system easy to scale horizontally. Uniform interface: resources are identified by URLs and manipulated through a small, consistent set of methods (GET/POST/PUT/DELETE) with self-descriptive messages. Client-server separation and cacheability are two more.

Why:

REST (Fielding) is defined by constraints including client-server separation, statelessness, cacheability, a uniform interface, layered system, and optional code-on-demand. Statelessness and the uniform interface are the two most distinctive: together they decouple clients from servers and let any server instance serve any request.

Order what happens when a browser makes a request to https://api.example.com/users, from typing the URL to rendering the data.#

Put these in order

Show answer

The request lifecycle runs in this order:

  1. Resolve api.example.com to an IP address via DNS.
  2. Open a TCP connection to that IP on port 443.
  3. Perform the TLS handshake to establish an encrypted channel.
  4. Send the HTTP request line and headers over the connection.
  5. The server routes, authorizes, and processes the request.
  6. Receive the HTTP status, headers, and body, then parse the data.
Why:

Each layer builds on the one before: name resolution, then a transport connection, then TLS over that connection, and only then the HTTP exchange. REST's stateless, layered design means the server processes each self-contained request independently and any number of intermediaries (proxies, load balancers, caches) can sit transparently between client and origin.

A REST API uses server-side session storage to track per-client state. A session ID is sent in a cookie, and the server keeps a map of session IDs to user data that it consults to interpret each request. Which REST architectural constraint does this design violate?#

Options

Show answer

Server-side session storage violates REST's stateless constraint. That constraint requires each request to carry all the information needed to process it, with no per-client context kept on the server between requests. A session map forces the server to look up prior state to understand a request, so requests cannot be interpreted in isolation.

Why:

REST's stateless constraint (Fielding's second constraint) requires each client request to contain all the information the server needs to understand and process it, and forbids the server from storing per-client context between requests. A server that keeps a map of session IDs to user data must consult that stored state to interpret a request, so the request is not self-descriptive and the design breaks statelessness. The other constraints do not fit this scenario: the uniform interface concerns resource identification and manipulation through representations, cacheable responses concern labeling responses as cacheable, and the layered system constraint concerns intermediaries between client and server; server-side sessions do not violate any of these.

Within REST's Uniform Interface constraint, the HATEOAS sub-constraint requires that server responses embed _____ (links and related controls) so that clients can discover available actions and navigate the API dynamically rather than relying on hard-coded URI templates.#

Show answer

Within REST's Uniform Interface constraint, the HATEOAS sub-constraint requires that server responses embed hypermedia (links and related controls) so that clients can discover available actions and navigate the API dynamically rather than relying on hard-coded URI templates.

Why:

HATEOAS stands for Hypermedia As The Engine Of Application State. It requires that resource representations include hypermedia controls (links, forms, or action descriptors) so the client can discover the valid next transitions at runtime. This decouples the client from the server's URI structure and is a core part of the Uniform Interface constraint.

A team designing a REST API argues: “Our API requires authentication, so it cannot be stateless.” In 2–3 sentences, explain why this reasoning is incorrect, clarifying what the REST statelessness constraint actually prohibits and what it does not prohibit.#

Show answer

REST statelessness only prohibits the server from storing session (application) state between requests. The client may send credentials or tokens with each request, and the server may authenticate each request independently using stored resource state such as credentials in a database. The constraint is about not relying on server-side session context from prior requests, not about forbidding all server-side data.

Why:

In Fielding's REST architectural style, the statelessness constraint requires that each client request contains all information needed to process it, without the server relying on stored session (application) state from previous interactions. This does not forbid the server from holding resource state such as user credentials in a database, nor does it forbid the client from sending authentication tokens or credentials with each request. A strong answer distinguishes session state from resource state and notes that authentication can be performed independently per request, so requiring authentication does not violate statelessness.

A Flask order-management API exposes PUT /orders/<id>. The handler reads the JSON body and updates only the status and items fields when those keys are present, leaving every other field of the stored order unchanged. Identify the REST/HTTP semantic violation in this design, and state which HTTP method the handler should use for partial modifications instead.#

Show answer

The PUT handler violates PUT's semantics: PUT must replace the entire target resource with the representation in the request body, but this handler performs a partial update. Under HTTP semantics (RFC 9110 §9.3.4), a PUT that omits fields should set them to their default or empty values rather than leave them untouched. Partial modifications belong to PATCH (RFC 5789), so the handler should either accept a full order representation via PUT or expose partial updates through PATCH.

Why:

The defining rule of PUT is full replacement of the target resource state by the request representation (RFC 9110 §9.3.4, which supersedes RFC 7231 §4.3.4). A handler that updates only the fields present in the body is performing a partial modification, which is the job of PATCH (RFC 5789). The correct fix is either to make PUT a full replacement, where omitted fields take default or empty values, or to serve partial changes through PATCH. Other aspects of the design, such as returning 200 OK for a GET of an existing resource or using UUIDs as identifiers, are not violations and are not the issue here.

In Roy Fielding's REST dissertation, what does the statelessness constraint require, and what are two benefits it provides compared to a stateful design?#

Show answer

The statelessness constraint requires that each request from client to server be self-contained, containing all information the server needs to understand and process it without relying on any server-side session state stored from previous interactions. The client is responsible for maintaining application state. Two key benefits are improved scalability, because servers need not retain per-client session data, and improved reliability, because individual requests can be retried independently without depending on prior server-side context.

Why:

Fielding's statelessness constraint requires that each client-to-server request contain all information necessary to understand the request, without the server relying on stored session state from prior interactions. The client must manage any application state. This design improves scalability because servers need not maintain per-client state across requests, and improves reliability because each request can be processed and retried independently. The main trade-off is increased network overhead, since repetitive context data must be included in every request.

The Richardson Maturity Model describes four levels of progress toward REST. Level 0 uses a single URI and a single HTTP method, essentially RPC over HTTP. Name the three key concepts introduced at Levels 1, 2, and 3 respectively, one per level, and briefly state what each adds.#

Show answer

Level 1 introduces resources: breaking a monolithic endpoint into separate, individually addressable entities with distinct URIs. Level 2 adds standard HTTP verbs (GET, POST, PUT, DELETE, PATCH) and HTTP status codes so that each interaction is self-descriptive. Level 3 adds hypermedia controls (HATEOAS), allowing clients to discover available state transitions dynamically through server-provided links rather than hard-coding URI templates.

Why:

The Richardson Maturity Model (proposed by Leonard Richardson) maps the incremental steps toward REST: Level 1 introduces resources (individually addressable URIs), Level 2 adds the correct use of HTTP verbs and status codes, and Level 3 adds hypermedia controls (HATEOAS) so clients can discover next actions from links in responses rather than hard-coding URIs. A correct answer must name all three concepts: resources, HTTP verbs, and hypermedia controls/HATEOAS, each tied to its level and to what it adds.

Fielding's REST architectural style defines several top-level constraints. One of them, the uniform interface constraint, is itself decomposed into four sub-constraints. Which of the following is a REST constraint but NOT one of the four sub-constraints of the uniform interface?#

Options

Show answer

Layered system is the REST constraint that sits outside the uniform interface. Fielding's dissertation lists it as a separate top-level constraint alongside client-server, statelessness, cacheability, and code-on-demand. Identification of resources, self-descriptive messages, and HATEOAS are all sub-constraints of the uniform interface.

Why:

In Fielding's dissertation, the uniform interface constraint has exactly four sub-constraints: identification of resources, manipulation of resources through representations, self-descriptive messages, and hypermedia as the engine of application state (HATEOAS). The layered system is a separate top-level constraint, listed alongside client-server, statelessness, cacheability, and the optional code-on-demand. So the layered system is the only choice that is a REST constraint but not part of the uniform interface, while self-descriptive messages, identification of resources, and HATEOAS are all uniform interface sub-constraints.

In Fielding's dissertation, REST is defined by a layered set of architectural constraints that together derive the network-based architectural style. Name the six constraints Fielding enumerates as defining REST, and briefly state what each one imposes.#

Show answer

REST is defined by six constraints: (1) Client-Server: separates user-interface concerns from data-storage concerns, improving portability and scalability. (2) Stateless: each request from client to server must contain all the information needed to understand it; no session state is kept on the server between requests. (3) Cache: responses must implicitly or explicitly define themselves as cacheable or non-cacheable, so clients can reuse data and reduce latency and server load. (4) Uniform Interface: a single generalized interface between components, typically achieved through resource identification, manipulation through representations, self-descriptive messages, and hypermedia as the engine of application state (HATEOAS). (5) Layered System: components are arranged in hierarchical layers so that each component can only see the immediately adjacent layer. (6) Code-on-Demand (optional): a server may extend client functionality by sending executable code, such as scripts or applets, which the client runs. The first five are mandatory; code-on-demand is the only optional constraint.

Why:

Fielding's dissertation enumerates six constraints: Client-Server, Stateless, Cache, Uniform Interface, Layered System, and Code-on-Demand. The question asks the reader to name each and state what it imposes, which is an open recall-and-explain task, so SHORT_ANSWER fits. The grader checks for the six constraint names, and the sample answer gives the concrete requirement each one places on the architecture, including the note that Code-on-Demand is the only optional constraint.

Order the following levels of the Richardson Maturity Model from LEAST REST-conforming to MOST REST-conforming.#

Put these in order

Show answer

The Richardson Maturity Model orders its levels from least to most REST-conforming as Level 0 (POX tunneling), Level 1 (individual resource URIs), Level 2 (HTTP verbs and status codes used per their semantics), then Level 3 (HATEOAS hypermedia controls). Each level builds on the one before it, so Level 3 is the most REST-conforming.

Why:

The Richardson Maturity Model defines four levels, each building on the previous one. Level 0 (POX) tunnels everything through HTTP using a single endpoint and POST for every operation. Level 1 introduces individual resource URIs. Level 2 adds correct use of HTTP methods and status codes according to their defined semantics. Level 3 (HATEOAS) adds hypermedia controls so clients discover available state transitions from responses rather than relying on out-of-band knowledge of URIs. The ascending order is therefore Level 0, Level 1, Level 2, Level 3, from least to most REST-conforming.

Sources

The official documentation these questions are checked against:

Related interview questions

Job market

See http-apis salaries and hiring demand from live job postings.

The other 5 questions

This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 5 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.