Key:
- Don't use PATCH OR use it the right way
- PATCH is not to replace POST or PUT
- PATCH applies a delta rather than replacing the entire resource
- PATCH is of a different content-type
PUT's payload is considered to be a modified version of the resource stored on the origin server, so the client is to replace itPATCH's payload contains a set of instructions about how to modify the resource on the origin server, so to produce a new version- You can use whatever format you want as “description of changes”
- That’s why using PATCH to send updated values only is not suitable.
// not correct
PATCH /users/123
{ “email”: "new.email@example.org” }
// not correct
PATCH /users/123?email=new.email@example.org
// correct
PATCH /users/123
[
{ "op": "replace", "path": "/email", "value": "new.email@example.org" }
]
-
RFC 7397: JSON Merge Patch, a "just send what you need" format
-
RFC 6902: JSON Patch, JSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JSON document.
application/json-patch+json
-
RFC 6901: JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
-
RFC 5261: XML patch framework.