PATCH Requests
Summary
Patches are to follow the IETF standard.
The body of a patch request consists of a set of changes that are to be applied to an entity. There are 6 acceptable instructions: Add, Remove, Update, Test, Move, and Copy.
Instructions
Instruction | Summary |
---|---|
Add | Adds a value to the specified field in the entity. |
Remove | Removes the value of the specified field. The value will return to the default value. |
Replace | Updates the value of the specified field. |
Test | Tests whether the value of the specified field is equal to the value in the request. |
Move | Moves the value from one field to another. |
Copy | Copies the value from one field to another. |
Request
The request must have a content-type of application/json-patch+json and a Http Action of PATCH.
The body consists of a list of changes to apply to the entity:
[
{ "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, "oldValue": 31 },
{ "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
{ "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
]
If "op" is entered as any value other than an accepted instruction, or if a required field is missing from an instruction the line will be ignored, and an error will be added to the response.
If a field that is not needed has a value in it, a warning is added to the response, but the instruction is executed.