Easy👤 0-2 years👤 3-5 years 1 min read

PUT vs PATCH — which do you use to update a resource, and why does it matter?

Asked inInfosysTCSCognizantAccenture
#put#patch#idempotency#partial update#rest
Report issue

⚡ Short Answer

PUT replaces the entire resource (send the full representation) and is idempotent. PATCH applies a partial modification (only changed fields) and isn't necessarily idempotent. Use PUT for full replacement, PATCH for partial updates — and document the PATCH format (merge vs JSON Patch).

Coffee Chat Question

Concept Made Simple

PUT vs PATCH — which do you use to update a resource, and why does it matter?

🧠Mind Map Answer

Remember It Faster

PUTfull replace, idempotent
PATCHpartial update, maybe not idempotent
GotchaPUT with missing fields can null them

⌨️Hands-on Keyboard

Learn by Doing

http
PUT /users/101        { "name":"John", "email":"j@x.com" }  # full
PATCH /users/101      { "email":"new@x.com" }                # partial

🔥What If?

Think Beyond the Expected

A client sends PUT with only the changed field and other fields get wiped — why?

PUT means 'replace the whole resource' — fields omitted from the body are treated as removed/defaulted. The client either must send the complete representation with PUT, or use PATCH for partial updates. This is a very common API bug.

😂Real World

Accidental data loss from partial PUTs is a frequent API bug; teams standardize on PATCH (often JSON Merge Patch) for edits and reserve PUT for full replacement or upsert.

🎯Interviewer's Expectation

Keywords they're listening for:

PUT replaces, PATCH partialPUT idempotentmissing fields on PUTPATCH format (merge/JSON Patch)

⚠️Common Mistakes

  • Using PUT for partial updates (wipes fields)
  • Assuming PATCH is always idempotent
  • Not documenting the PATCH body format

Best Practices

  • PATCH for partial edits, PUT for full replace
  • Pick and document a PATCH format
  • Validate the full body on PUT

🔁Follow-up Questions

  • 1Is PATCH idempotent? When is it / isn't it?
  • 2JSON Merge Patch vs JSON Patch (RFC 6902)?
  • 3Can PUT create a resource (upsert)?

🧩Related Technologies

JSON Merge PatchJSON Patch (RFC 6902)idempotency

Continue Learning with AI

Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.

Plain-language foundations

I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner.

Topic: HTTP Methods (REST APIs)
Interview question: "PUT vs PATCH — which do you use to update a resource, and why does it matter?"

Please:
1. Explain the core idea in simple, plain language, using an everyday analogy.
2. Define any technical terms you use.
3. Walk through one small, concrete example.
4. Finish with a single sentence I can easily remember.

Keep the tone friendly and assume I'm new to this topic.
Open inChatGPTGeminiClaude

Was this answer helpful?

Support our platform by exploring our recommended products.

As an Amazon affiliate, purchases through these links may earn us a small commission — at no extra cost to you. It helps keep Full Stack Interview Guru free.

Related Questions