Update image metadata items

Overview

Updates metadata items by key for a specified image.

Classification

  • Update

API Operation Object

  • images

Synchronous / Asynchronous

  • -

Request

HTTP Request Method

  • POST

HTTP Request Path

{api_endpoint}/v2/{tenant_id}/images/{image_id}/metadata

HTTP Request Header

Format

Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: <token_id>
Content-Type: application/json

HTTP Request Body

Format

{
    "metadata": {
        "kernel_id": "<True or False>",
        "Label": "<Label>"
    }
}

Request Parameter

Request Parameters
name style format description required/optional
tenant_id URI UUID The tenant ID in a multi-tenancy cloud. required
image_id URI UUID The UUID for the image. required

Response

HTTP Response Header

Format

HTTP/1.1 <response_code> <message>       (ex. 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 "Content-Length", "Date"

Response Code

Response Codes
response code condition
200 normal end
400 badRequest
- NetworkNotFound
401 unauthorized
403 forbidden
404 itemNotFound
405 badMethod
409 buildInProgres
413 overLimit
415 badMediaType
503 serviceUnavailable

HTTP Response Body

Format

{
    "metadata": {
        "Label": "<Label>",
        "architecture": "<architecture>",
        "auto_disk_config": "<auto_disk_config>",
        "kernel_id": "<kernel_id>",
        "ramdisk_id": "<ramdisk_id>"
    }
}

Response Parameter

Response Parameters
item format description
next (Optional) anyURI Moves to the next metadata item.
previous (Optional) anyURI Moves to the previous metadata item.
Label String Label of metadata
architecture String The architecture of the metadata
auto_disk_config boolean
Processing method of the root disk partition.
If True, to use all available virtual disk
If False, and use the size of the image
kernel_id String kernel id
ramdisk_id String ramdisk id

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{tenant_id}/images/{image_id}/metadata

Request Header

Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: ajk3adjiown02
Content-Type: application/json

Request Body

{
    "metadata": {
        "kernel_id": "False",
        "Label": "UpdatedImage"
    }
}

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 "Content-Length", "Date"

Response Body

{
    "metadata": {
        "Label": "UpdatedImage",
        "architecture": "x86_64",
        "auto_disk_config": "True",
        "kernel_id": "False",
        "ramdisk_id": "nokernel"
    }
}

Execution Example

HTTP Request

GET /v2/f66f8e846a65484a9a6740077e72e3dd/images/e1cfdfe1-669f-4343-91ab-7eb699cda5c7/metadata HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: eb46ce9e8a204cbabacc51282ac691ad
Accept: application/json

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 16
X-Compute-Request-Id: req-8d0a828b-dcb2-4108-bdd8-cb33d14290f6
Date: Wed, 07 Oct 2015 05:55:59 GMT

{"metadata": {"label": "UpdatedImage"}}

Error Execution Example

HTTP Request

POST /v2/f66f8e846a65484a9a6740077e72e3dd/images/e1cfdfe1-669f-4343-91ab-7eb699cda5c7/metadata HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: eb46ce9e8a204cbabacc51282ac691ad
Accept: application/json

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 141
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-a38cc946-ae7d-4279-ace9-4d9aa71d8630
Date: Wed, 07 Oct 2015 05:48:58 GMT

{"badRequest": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400}}