Concept
Patch Requests
PATCH requests are a bit different than other HTTP requests. These follow the guidelines of the JSONPatch (IETF: RFC 6902) standard. A generic example taken from the definition can be seen below.
HTTP
PATCH /api/v1/departments/[ID] HTTP/1.1
Content-type: application/json-patch+json
Authorization: Bearer [Your token]
[
{ "op": "test", "path": "/a/b/c", "value": "foo" },
{ "op": "remove", "path": "/a/b/c" },
{ "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },
{ "op": "replace", "path": "/a/b/c", "value": 42 },
{ "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
{ "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
]
While application/json-patch+json
is the prefered content-type, we also accept application/json
and will handle it the same.