HTTP and REST Interview Questions
Part of the Web Development Roadmap
In short
Status codes, idempotency, headers, caching: interviewers use these to check you really understand the web, not just your framework. They're quick wins if you prepare.
Interviewers often ask what happens when you type a URL, the difference between HTTP methods, common status codes, REST design, cookies and CORS.

Think of it like this
Sending a parcel at the post office
The envelope has an address (URL), a service type like speed post (method), stamps and labels (headers) and the letter inside (body). The counter hands you a receipt (status code) saying accepted, rejected or wrong address.
Watch it happen
One resource, many conversations
POST /orders
1/8Create a new order. POST is not idempotent: sending it twice can create two orders.
The big ideas
What you need to know
Safe and idempotent
GET is safe. GET, PUT and DELETE are idempotent: repeating them gives the same result. POST usually isn't.
Status code families
2xx success, 3xx redirect, 4xx client mistake, 5xx server failure. Know 200, 201, 204, 304, 400, 401, 403, 404, 409, 429, 500 and 503.
Headers do real work
Content-Type, Authorization, Cache-Control, ETag and Location carry meaning. Name a few with their purpose.
REST is stateless
Each request carries everything needed, like the auth token. That's what lets you add servers freely.
See it in code
Walk through the code
1POST /api/orders HTTP/1.12Host: api.shop.dev3Content-Type: application/json4Authorization: Bearer eyJhbGciOi...5Idempotency-Key: 8f14e45f-ea7c-4e1b6 7{ "productId": 42, "quantity": 2 }8 9HTTP/1.1 201 Created10Location: /api/orders/98111Content-Type: application/json12 13{ "id": 981, "status": "pending_payment" }1/4Method, path and protocol version.
An Idempotency-Key lets the server spot a retried POST and return the first result instead of creating a second order.
Save yourself the pain
Common mistakes
Oops
Returning 200 with { "error": "not found" } in the body.
Do this instead
Use the real status code, 404. Clients, caches and monitoring tools all rely on it.
Oops
Mixing up 401 and 403.
Do this instead
401 means not authenticated (who are you?). 403 means authenticated but not allowed.
Your mission
Status code drill
Quick check
A request times out and the client retries automatically. Which one is safe to retry without doubling the effect?
Go deeper
- 1Prepare a clear answer to 'what happens when you type a URL and press Enter'.
- 2Be ready to design the REST endpoints for a simple app on a whiteboard.
- 3Revise the status codes your own APIs return and why.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.