Create or replace volume metadata items¶
Overview¶
Creates or replaces metadata items for a specified volume.
Classification¶
Create
API Operation Object¶
metadata
Synchronous / Asynchronous¶
-
Request¶
HTTP Request Method¶
PUT
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¶
PUT /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: 52
{"metadata": {"key3": "val3","key1": "val1_update"}}
HTTP Response¶
HTTP/1.1 200 OK
X-Compute-Request-Id: req-5f7ba430-7e6e-4998-a327-b32d582bd4d4
Content-Type: application/json
Content-Length: 53
X-Openstack-Request-Id: req-5f7ba430-7e6e-4998-a327-b32d582bd4d4
Date: Thu, 15 Oct 2015 13:23:50 GMT
{"metadata": {"key3": "val3", "key1": "val1_update"}}
Error Execution Example¶
HTTP Request¶
PUT /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: 52
{"metadata": {"key3": "val3","key1": "val1_update"}}
HTTP Response¶
HTTP/1.1 400 Bad Request
Content-Length: 65
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-9120f040-72d1-4d7a-b858-bcbc1bda95d2
X-Openstack-Request-Id: req-9120f040-72d1-4d7a-b858-bcbc1bda95d2
Date: Thu, 15 Oct 2015 13:24:01 GMT
{"badRequest": {"message": "Malformed request url", "code": 400}}