All jobs / Backend developer / API Development
Backend developer interview question · 0–1 years
The interviewer sketches /getOrder and /doDeleteUser. Strongest design?
The strongest answer
Model URLs as nouns — /orders/12 — and use the HTTP verb for the action. Don't put get or delete in the path.
Why it works
Exactly. REST's uniform interface is the verb plus a resource. /orders/12 + DELETE is cacheable, loggable and obvious.
What a good answer covers
- Resources are nouns; verbs belong to HTTP.
- GET /orders/12, DELETE /orders/12 — not /getOrder.
- Query strings filter; they don't mean “do.”
- Never make GET mutate.
Answers that fall short
- Close, but not the strongest: Use nouns for collections and put the action in a query string, like /orders?action=delete.
Nouns help, but action=delete on a GET-shaped URL is still an RPC with extra steps — and a query string that looks safe to retry. - Weak: One /api endpoint that takes { action, payload } in the JSON body so I never add routes.
A single RPC dump throws away status codes, caching and the ability to reason about one resource. - Red flag: GET /deleteUser?id=12 so the browser can prefetch it.
A GET that deletes is the classic accident: crawlers, prefetch and retry will destroy data.
Who gets asked this
More API Development questions
- The interviewer asks: “Which HTTP methods are safe to retry, and why?” Strongest answer?
- The interviewer asks: “How do you send and read JSON on an HTTP API?” Strongest answer?
- The interviewer asks: “What status do you return when POST creates a resource?” Strongest answer?
- The interviewer asks: “When do you nest URLs like /orders/12/items?” Strongest answer?
- In a GraphQL API, what is the schema and what is a resolver?
- The interviewer asks: “Do you return the database entity as JSON?” Strongest answer?
- The interviewer asks: “A handler throws. What does the client see?” Strongest answer?
- The interviewer asks: “How do you paginate a list endpoint?” Strongest answer?