All jobs / Backend developer / API Development
Backend developer interview question · 0–1 years
The interviewer asks: “Which HTTP methods are safe to retry, and why?” Strongest answer?
The strongest answer
GET, HEAD, PUT and DELETE should be idempotent: repeating the same request does not create extra side effects. POST usually is not — retrying it can create a second order.
Why it works
Exactly. Idempotent means the effect of N identical calls is the same as one. That's why timeouts on GET/PUT are retryable and a raw POST needs an idempotency key.
What a good answer covers
- Idempotent = same effect if I send it again.
- GET/PUT/DELETE are built for that.
- POST creates — retry only with a key.
- Identical JSON is not the test.
Answers that fall short
- Close, but not the strongest: GET is safe to retry; I treat every other method as once-only.
GET is the easy case. PUT and DELETE are designed to be retried too — “set this representation” / “make it gone.” Don't throw that away. - Weak: Idempotent means the response body is always byte-for-byte identical.
The body can differ (timestamps, ETags). Idempotence is about server state, not the JSON looking the same. - Red flag: I retry POST /orders in a loop until I get 201 — the user just wants the order to exist.
A retry loop on POST is how you double-charge. Make the create idempotent first, or don't retry blindly.
Who gets asked this
More API Development questions
- 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?
- The interviewer asks: “Where do you validate input?” Strongest answer?