Update volume metadata items¶
Overview¶
Updates metadata items by key for a specified volume.
Classification¶
Update
API Operation Object¶
metadata
Synchronous / Asynchronous¶
-
Request¶
HTTP Request Method¶
POST
HTTP Request Path¶
{api_endpoint}/v2/{tenant_id}/volumes/{volume_id}/metadata
HTTP Request Header¶
Format¶
Accept-Encoding: gzip, deflate, compress(optional)
Accept: application/json
X-Auth-Token: <token_id>
Content-Type: application/json
Response¶
Sample API Request and Response¶
Sample API Request¶
Request URI¶
https://example.com/v2/{tenant_id}/volumes/{volume_id}/metadata
Request Header¶
Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: ajk3adjiown02
Content-type: application/json
Request Body¶
{
"metadata": {
"<key>": "<value>",
<<repeat>>
}
}
Sample API Response¶
Response Header¶
HTTP/1.1 200 OK
<response_code>: see "HTTP Responses" section
<message>: message based on the response code
skip auto insert field such as "X-Compute-Request-Id" and "X-Openstack-Request-Id", "Content-Length", "Date"
Response Body¶
{
"metadata": {
"<key>": "<value>",
<<repeat>>
}
}
Execution Example¶
HTTP Request¶
POST /v2/cb8aa2a2c7244af5aab1fa7881ba7f4c/volumes/ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2/metadata HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8776
X-Auth-Token: 1d821d6c5d13437daac9f329653a8bf2
Content-type: application/json
Accept: application/json
Content-Length: 45
{"metadata": {"key2": "val2","key1": "val1"}}
HTTP Response¶
HTTP/1.1 200 OK
X-Compute-Request-Id: req-d168f0ec-960d-4f5f-8178-83485b0cd732
Content-Type: application/json
Content-Length: 46
X-Openstack-Request-Id: req-d168f0ec-960d-4f5f-8178-83485b0cd732
Date: Thu, 15 Oct 2015 13:22:56 GMT
{"metadata": {"key2": "val2", "key1": "val1"}}
Error Execution Example¶
HTTP Request¶
POST /v2/cb8aa2a2c7244af5aab1fa7881ba7f4/volumes/ec48eb1f-f32e-43ee-97ab-9a6c453bc3b2/metadata HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8776
X-Auth-Token: 1d821d6c5d13437daac9f329653a8bf2
Content-type: application/json
Accept: application/json
Content-Length: 45
{"metadata": {"key2": "val2","key1": "val1"}}
HTTP Response¶
HTTP/1.1 400 Bad Request
Content-Length: 65
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-52fa6ea4-079b-4609-8d3d-a5fb64c4dfb9
X-Openstack-Request-Id: req-52fa6ea4-079b-4609-8d3d-a5fb64c4dfb9
Date: Thu, 15 Oct 2015 13:23:27 GMT
{"badRequest": {"message": "Malformed request url", "code": 400}}