All jobs / Backend developer / API Development
Backend developer interview question · 1–3 years
The interviewer asks: “PUT versus PATCH?” Strongest answer?
The strongest answer
PUT replaces the resource with the body I send (idempotent full document). PATCH applies a partial update. I don't overload PUT with “only the fields I included.”
Why it works
Exactly. Clients and caches treat PUT as “this is the new representation.” Partial PUT is how you wipe fields you didn't mean to send.
What a good answer covers
- PUT = full replace; PATCH = partial.
- Don't send a subset as PUT.
- PATCH is current, not deprecated.
- Omitted ≠ null unless the client said so.
Answers that fall short
- Close, but not the strongest: They're the same — I use PUT for updates because it's simpler.
Simpler for you, surprising for every HTTP-aware client. If you only send a subset, that's PATCH (or a dedicated action). - Weak: PATCH is deprecated; everyone uses POST to /update.
PATCH is in wide use (JSON Merge Patch / JSON Patch). POST /update is an RPC you don't need. - Red flag: I accept PUT with a partial body and null-out every missing field so the client learns to send everything.
Nulling omitted fields is a data-loss footgun. That's the bug PUT-partial causes in the wild.
Who gets asked this
More API Development questions
- The interviewer asks: “How should API errors look to clients?” Strongest answer?
- The interviewer asks: “How do you version a public JSON API?” Strongest answer?
- When would you pick gRPC over a JSON REST API, and what do you give up?
- Your OpenAPI document lists every path and method and nothing else. A partner team says integrating still…
- The interviewer asks: “You're building an internal platform API other teams will live on. What changes?”…
- The interviewer asks: “When do you use GET versus POST?” Strongest answer?
- The interviewer asks: “What's the difference between HTTP 401 and 403?” Strongest answer?
- The interviewer asks: “When is 404 the right status, and when is 400?” Strongest answer?