The 'application/openstack-images-v2.1-json-patch' media type supports a subset of the operations defined in the 'application/json-patch+json' media type. The operation to perform is expressed as the value of the "op" member of the operation object.
The operations supported are: "add", "remove", "replace".
It is an error condition if an operation object contains no recognized operation member.
The location within the target image where the requested operation is to be performed is specified by using the "path" member of the operation object.
The member value is a string containing a restricted JSON pointer value that references the location where the operation is to be performed within the target image.
Where appropriate (that is, for the "add" and "replace" operations), the operation object must contain a third data member, "value".
The member value is the actual value to add (or to use in the replace operation) expressed in JSON notation. (For example, strings must be quoted, numeric values are unquoted.)
The payload for a PATCH request must be a list of json objects, each of which adheres to one of the formats described below.
add
The "add" operation adds a new value at a specified location in the target image. The location must reference an image property to add to an existing image. The operation object contains a "value" member that specifies the value to be added.
Example:
{ "op": "add", "path": "/login-name", "value": "kvothe"}
remove
The "remove" operation removes the specified image property in the target image. It is an error condition if no image property exists at the specified location.
Example:
{ "op": "remove", "path": "/login-name" }
replace
The "replace" operation replaces the value of the specified image property in the target image with a new value. The operation object contains a "value" member that specifies the replacement value.
Example:
{ "op": "replace", "path": "/login-name", "value": "kote" }
This operation is functionally identical to expressing a "remove" operation for an image property, followed immediately by an "add" operation at the same location with the replacement value.
It is an error condition if the specified image property does not exist for the target image.