What is the difference between PUT and PATCH?
Answer
PUT replaces a resource entirely with the provided representation. If you send PUT /users/42 with { "name": "Alice" }, all fields not included in the body are set to null/default. PUT requires the client to send the complete resource — you must first GET the resource, modify it, then PUT the full updated version. PATCH applies a partial update — only the fields included in the body are changed. PATCH /users/42 with { "name": "Alice" } changes only the name; all other fields remain unchanged. PATCH is more bandwidth-efficient for large resources where only a small field changes. JSON Patch (RFC 6902) formalizes PATCH operations: [{ "op": "replace", "path": "/name", "value": "Alice" }]. In practice, PATCH is more commonly used for partial updates in modern APIs.
Previous
What is the RFC 7807 Problem Details format for REST API errors?
Next
How do you handle long-running async operations in REST APIs?
More REST API Design Questions
View all →- Intermediate What is HATEOAS and how is it implemented?
- Intermediate What are the main API versioning strategies in REST and what are their tradeoffs?
- Intermediate What are the pagination strategies in REST APIs?
- Intermediate What is rate limiting and how is it communicated in REST APIs?
- Intermediate How does HTTP caching work in REST APIs with ETag and Cache-Control?