Update an image
PATCH /v2/images/{image_id}
Normal response codes: 200
It is necessary to specify application/openstack-images-v2.1-json-patch for the Content-Type of the request header.
e7db3b45-8db7-47ad-8109-3fb55c2c24fd as an example:
[
{"op": "replace", "path": "/name", "value": "Fedora 17"},
{"op": "replace", "path": "/tags", "value": ["fedora", "beefy"]}
]
The response body shows the updated image entity. For example:
{
"id": "e7db3b45-8db7-47ad-8109-3fb55c2c24fd",
"name": "Fedora 17",
"status": "queued",
"visibility": "private",
"tags": ["fedora", "beefy"],
"created_at": "2012-08-11T17:15:52Z",
"updated_at": "2012-08-11T17:15:52Z",
"self": "/v2/images/e7db3b45-8db7-47ad-8109-3fb55c2c24fd",
"file": "/v2/images/e7db3b45-8db7-47ad-8109-3fb55c2c24fd/file",
"schema": "/v2/schemas/image"
}
The PATCH method can also be used to add or remove image properties. To add a custom user-defined property such as "login-user" to an image, use the following example request.
[
{"op": "add", "path": "/login-user", "value": "kvothe"}
]
Similarly, to remove a property such as "login-user" from an image, use the following example request.
[
{"op": "remove", "path": "/login-user"}
]
See Appendix B for more details about the 'application/openstack-images-v2.1-json-patch' media type.
Property protections
Version 2.2 of the Images API acknowledges the ability of a cloud provider to employ property protections. Thus, there may be image properties that may not be updated or deleted by non-admin users.