Interview Prep
Backend & APIs Interview Questions
Server-side design, REST and API questions, and the protocols underneath them.
12 of 12 Backend & APIs questions shown. Answers are hidden by default — try each one before revealing it.
1.Which of these HTTP methods is NOT idempotent, meaning that sending the same request multiple times can leave the server in a different end state than sending it once?
Mediumhttprestidempotency
2.A client sends POST /orders to create a new order. The server creates it successfully and returns a representation of the new order in the body, along with a Location header pointing at it. Which status code should the response use?
Easyhttpstatus-codesrest
3.What does it mean for a REST API to be stateless, as one of REST's architectural constraints?
Mediumreststatelessnessapi-design
4.What is the key practical difference between session-based authentication (server-side session plus a cookie) and token-based authentication using a signed JWT sent as a Bearer token?
Hardauthenticationjwtsessions
5.A client sends a request with a valid, correctly authenticated token, but that user is not allowed to access the requested resource. Which status code should the server return?
Easyhttpstatus-codesauthorization
6.What is the semantic difference between PUT and PATCH when updating a resource?
Easyhttprestapi-design
7.Design a REST endpoint for creating a comment on a blog post: POST /posts/{postId}/comments. Walk through the request and response you would design, and explain which status codes you would return for the success case and at least two failure cases.
Mediumrestapi-designstatus-codes
8.Explain the difference between authentication and authorization in the context of an API, and give an example of how a request can fail each one separately.
Easyauthenticationauthorizationapi-design
9.When would you choose to put a message queue between two services instead of having one service call the other's API directly? What do you give up by doing that?
Mediumsystem-designqueuesasync
10.Explain what idempotency means for an API endpoint, and why it matters when a client needs to retry a request, such as after a network timeout. Use a payment endpoint as an example.
Mediumidempotencyreliabilityapi-design
11.REST defines statelessness as a core architectural constraint, meaning the server should not store client session state between requests. Explain what this means concretely, and why it matters for scaling an API horizontally.
Mediumrestscalabilitystatelessness
12.You need to design pagination for a REST endpoint like GET /orders that can return millions of rows. Compare offset-based pagination (?page=3&pageSize=50) with cursor-based pagination (?after=<cursor>&limit=50), and explain which you would pick and why.
Hardapi-designpaginationscalability