HTTP & APIs Interview Questions — API Design Practice Quiz
Reviewed by Mark Dickie · Last updated
HTTP API design is the practice of defining how clients and servers communicate over HTTP using methods, status codes, headers, and resource-oriented URLs. For an interview on this topic, you should know the semantics of HTTP methods (safe vs. unsafe, idempotent vs. non-idempotent), the meaning of common status code classes, how to structure resource URLs and relationships, and the trade-offs between versioning strategies. You should also be able to explain idempotency, content negotiation, pagination, and when to use PATCH vs. PUT.
What HTTP methods should I know for an API design interview?
The table below covers the methods that come up most often:
| Method | Safe | Idempotent | Typical Use |
|---|---|---|---|
| GET | Yes | Yes | Retrieve a resource |
| POST | No | No | Create a resource, trigger an action |
| PUT | No | Yes | Replace a resource at a known URL |
| PATCH | No | Not guaranteed | Apply a partial update |
| DELETE | No | Yes | Remove a resource |
Safe methods must not change server state; idempotent methods produce the same result no matter how many times you call them. PATCH is the one that trips candidates up because its idempotency depends on the patch format — a JSON Merge Patch that sets a field to null is idempotent, but a JSON Patch operation that appends to an array is not.
How do I choose status codes?
Group them by class first, then pick the specific code that matches the outcome:
- 2xx — the request succeeded. Use
200 OKfor a normal response,201 Createdwhen a new resource was made (include aLocationheader), and204 No Contentwhen there is no body to return (e.g., a successful DELETE). - 3xx — redirection.
301 Moved Permanentlyand308 Permanent Redirectmatter for URL changes;304 Not Modifiedpairs with conditional requests viaETagorIf-Modified-Since. - 4xx — the client messed up.
400 Bad Requestfor malformed input,401 Unauthorizedfor missing or bad credentials,403 Forbiddenfor valid auth but insufficient permissions,404 Not Foundfor a missing resource,409 Conflictfor a race or duplicate, and422 Unprocessable Entityfor well-formed input that fails validation. - 5xx — the server messed up.
500 Internal Server Erroris the catch-all;502 Bad Gatewayand503 Service Unavailableappear when a proxy or upstream dependency fails.
What does an API design interview typically test?
Expect questions that mix HTTP mechanics with design judgment. Interviewers want to see whether you can:
- Pick the right method and status code for a given scenario instead of defaulting to POST and 200 for everything.
- Design resource URLs that are predictable and nested sensibly (e.g.,
/users/42/ordersrather than/getOrdersByUser?userId=42). - Handle pagination, filtering, and sorting with query parameters in a way that scales.
- Explain versioning approaches (URI path
/v1/, header-based, or query parameter) and argue for one based on the audience and churn rate. - Discuss error response shape — returning a consistent JSON body with a machine-readable code, a human message, and enough context for a client to recover.
The quiz below lets you test yourself against these areas with questions drawn from real interview settings.
Key facts
- Tarmac has 35 HTTP & APIs interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac last reviewed these HTTP & APIs interview questions on 17 August 2026.
At a glance
| Questions | 10 shown · 35 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Fill in the blank, Multiple choice, True / false, Ordering, Multiple answer, Short answer |
What you'll review
- api design
Practice questions
HTTP & APIs/api-design
Complete the following statement about REST API design:#
Show answer
Complete the following statement about REST API design:
"A REST API endpoint that retrieves a list of all orders for a specific user might be structured as: GET /**users**/{userId}/**orders**"
RESTful URL design uses plural nouns to represent collections and nests child resources under their parent. The pattern GET /users/{userId}/orders reads naturally: 'get the orders belonging to the user with id userId'. Using nouns (not verbs) and hierarchical paths is a core REST design principle.
HTTP & APIs/api-design
A REST API needs to return a list of users. According to REST best practices, which of the following URL designs is most appropriate?#
Options
Show answer
The correct URL design is GET /users. REST best practices use plural nouns to represent resource collections and rely on HTTP methods (GET, POST, etc.) to express the action — embedding verbs like getUsers or fetchUsers in the path is redundant and non-RESTful.
REST API design favors nouns over verbs in URL paths, and uses plural resource names to represent collections. The HTTP method (GET) already conveys the action, so embedding verbs like 'get' or 'fetch' in the path is redundant and violates REST conventions. /users is a clean, noun-based, plural resource path that correctly represents a collection of user resources.
HTTP & APIs/api-design
An HTTP PUT request is idempotent, meaning that making the same PUT request multiple times should produce the same result as making it once.#
Options
Show answer
True — HTTP PUT is idempotent. Sending the same PUT request multiple times leaves the server in the same state as sending it once, because PUT replaces (or creates) the resource at the specified URL with the given data each time. This contrasts with POST, which typically creates a new resource on every call.
Idempotency means that repeating the same operation multiple times yields the same server state as performing it once. PUT is defined as idempotent by the HTTP specification: sending PUT /users/1 with the same body replaces the resource each time, leaving the server in the identical state after the first call. This is unlike POST, which typically creates a new resource on each request and is therefore NOT idempotent.
HTTP & APIs/api-design
Arrange the following HTTP status code ranges in order from the one that indicates informational responses to the one that indicates server-side errors (lowest to highest):#
Put these in order
Show answer
The correct order from lowest to highest is: 1xx Informational → 2xx Success → 3xx Redirection → 4xx Client Error → 5xx Server Error. HTTP groups status codes by their first digit, and each range has a distinct meaning: 1xx for interim responses, 2xx for successful operations, 3xx for redirects, 4xx for client mistakes, and 5xx for server failures.
HTTP status codes are grouped into five classes by their first digit: 1xx (Informational), 2xx (Success), 3xx (Redirection), 4xx (Client Error), and 5xx (Server Error). Understanding this classification is fundamental to API design and debugging — for example, knowing that a 404 is a client-side 'not found' error while a 502 is a server-side 'bad gateway' error.
HTTP & APIs/api-design
A team is designing a RESTful API for a resource /orders. Which of the following practices are considered correct REST API design? Select all that apply.#
Options
Pick every one that applies.
Show answer
- Use
POST /ordersto create a new order. - Return
201 Createdwith aLocationheader pointing to the new resource after a successfulPOST /orders. - Use
PATCH /orders/42to partially update an existing order.
REST conventions dictate that POST /orders creates a resource and should return 201 Created alongside a Location header pointing to the newly created resource. PATCH /orders/{id} is the correct verb for a partial update. GET /orders/delete?id=42 violates the constraint that GET must be safe and idempotent — deletion should use DELETE. PUT /orders without an identifier is semantically incorrect for updating a single resource; it would imply replacing the entire collection.
HTTP & APIs/api-design
A client makes a cross-origin request that triggers a CORS preflight flow, and then retrieves data from the API. Place the following events in the correct chronological order.#
Put these in order
Show answer
The correct order is: (1) Client sends the OPTIONS preflight request → (2) Server responds with CORS policy headers → (3) Browser validates the preflight response → (4) Client sends the actual request → (5) Server returns the resource. The browser-initiated OPTIONS preflight must complete and be validated before the real request is ever sent.
CORS preflight always begins with the browser automatically sending an OPTIONS request containing Origin and Access-Control-Request-Method (step a). The server replies with the allowed origins, methods, and headers (step b). The browser then validates those headers against the pending request (step e). Only if the preflight succeeds does the browser dispatch the actual request (step c), and the server finally responds with the resource plus CORS headers (step d).
HTTP & APIs/api-design
A public REST API currently returns the following response for GET /users/{id}:#
Options
Pick every one that applies.
Show answer
The breaking changes that call for a new major version are: renaming full_name to name, removing internal_score from the response, changing id from an integer to a UUID string, and returning a 200 with {} instead of a 404 when a user is not found. Each of these can make a correctly written client behave differently without any code change — a field rename or removal breaks readers of the old key, the type swap on id breaks numeric handling, and the status change breaks clients that branch on 404 to detect a missing resource. Adding a new optional field, by contrast, is an additive, non-breaking change under most REST contracts.
Breaking changes are those that can cause existing well-written clients to behave incorrectly without modification. (a) Renaming full_name to name breaks clients that read full_name. (c) Removing internal_score breaks clients that depend on it. (d) Changing id's type from integer to string breaks clients that store or compare it as a number. (e) Returning 200 instead of 404 for a missing resource breaks clients that branch on HTTP status codes to detect absence. Adding a new optional field (b) is generally considered a non-breaking, additive change under most REST versioning contracts.
HTTP & APIs/api-design
You are designing a REST API endpoint that allows a client to partially update a resource. The client wants to update only the email field of a user without touching any other fields. Explain which HTTP method you should use, why it is preferred over the alternative update method for this use case, and what a minimal correct request would look like (method, path, and body).#
Show answer
Use PATCH instead of PUT. PUT is meant for full replacement of a resource — the client must send the complete representation, and any omitted fields may be set to null or cause errors. PATCH is designed for partial updates: the client sends only the fields it wants to change. A correct request would be: PATCH /users/42 with body {"email": "[email protected]"}. The server applies only that change, leaving all other fields intact.
PATCH is the semantically correct method for partial updates per RFC 5789. PUT implies a complete replacement of the resource at the given URI; sending a partial body with PUT can lead to data loss or implementation-specific behavior. PATCH lets clients send a diff/patch document (often just a JSON subset) so only specified fields are changed. Strong candidates also note that PUT is idempotent and PATCH may be idempotent depending on the patch semantics, and that the server should return 200 or 204 on success.
HTTP & APIs/api-design
HTTP/2 multiplexing completely eliminates head-of-line (HOL) blocking for all requests sharing a single connection, including scenarios involving packet loss at the TCP layer.#
Options
Show answer
False. HTTP/2 multiplexing eliminates HOL blocking at the HTTP layer by interleaving frames from multiple streams on one connection, but TCP's own HOL blocking remains: a single lost packet stalls every stream on that connection until it is retransmitted. HTTP/3 (QUIC over UDP) is what actually addresses the TCP-level HOL problem.
HTTP/2 multiplexing eliminates head-of-line blocking at the HTTP layer by allowing multiple streams over a single TCP connection. However, TCP itself still suffers from head-of-line blocking at the transport layer — a single lost packet stalls all streams on that connection. HTTP/3 (QUIC) solves this by operating over UDP with per-stream loss recovery. The statement that HTTP/2 fully eliminates head-of-line blocking is therefore false; it only solves it at the application layer, not the transport layer.
HTTP & APIs/api-design
A platform team is designing a public REST API that must support multiple concurrent versions for at least 3 years. They are debating four versioning strategies:#
Show answer
Media-type (Accept header) versioning best preserves URI stability and aligns with REST constraints because the URI identifies the resource (/orders), not a versioned contract, and HTTP content negotiation (the Accept/Content-Type headers) is the standard mechanism to negotiate representation formats. Two concrete production drawbacks are: (1) Discoverability and testability — browser address bars, curl without flags, and API explorers do not easily send custom Accept headers, making manual testing and onboarding harder compared to URL versioning. (2) Caching complexity — intermediate caches (CDNs, proxies) key on the URL by default; responses differentiated only by the Accept header require a Vary: Accept response header to be cache-correct, and many CDNs handle Vary poorly or ignore it, leading to cache poisoning or under-caching.
This question tests deep knowledge of REST API design trade-offs for versioning strategies. URL path versioning (/v1/...) is simple and cache-friendly but pollutes the URI space and couples clients to implementation versions. Accept/Content-Type header versioning (media-type versioning, e.g., application/vnd.myapi.v2+json) is the most RESTful because URIs identify resources, not resource versions — it also enables content negotiation. However, it is harder to test in a browser and less visible in logs. Custom request header versioning (e.g., X-API-Version: 2) is not part of the HTTP standard and not cache-key-aware by default (requires a Vary header). Query parameter versioning (?version=2) is easy to use but semantically incorrect since query params should filter/sort resource representations, not identify API contracts. The key staff-level insight is that only media-type versioning preserves URI stability and leverages HTTP content negotiation correctly, making it the approach most aligned with REST constraints, even though URL versioning dominates in practice for pragmatic reasons.
Sources
The official documentation these questions are checked against:
Related interview questions
The other 25 questions
This page shows 10. A free account opens the rest and marks your answers, which a page of answers can't do. Miss one and it returns a few days later, then a week after that, until you stop missing it.
Free · the whole bank · 100 graded answers per 30 days · written feedback and job-ad quizzes on the paid plan