Show server metadata

Overview

Shows metadata for a specified server.

Classification

  • Show

API Operation Object

  • metadata

Synchronous / Asynchronous

  • -

Request

HTTP Request Method

  • GET

HTTP Request Path

{api_endpoint}/v2/{tenant_id}/servers/{server_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

  • none

Request Parameter

Request Parameters

name

style

format

description

required/optional

tenant_id

URI

UUID

The tenant ID in a multi-tenancy cloud.

required

server_id

URI

UUID

The UUID for the server.

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, 203

normal end

400

computeFault

-

badRequest

401

unauthorized

403

forbidden

404

itemNotFound

405

badMethod

413

overLimit

500

computeFault

503

serviceUnavailable

HTTP Response Body

Format

{
    "metadata": {
        "<metadata_key>": "<metadata_value>"
    }
}

Response Parameter

Response Parameters

item

format

description

X-Compute-Request-ID

String

Returns a unique identifier to provide tracking for the request. The request ID that is associated with the request appears in the log lines for that request. By default, the middleware configuration ensures that the request ID appears in the log files.

next

anyURI

Moves to the next metadata item.

previous

anyURI

Moves to the previous metadata item.

metadata_key

String(1-255 characters)

key for metadata Server Metadata

metadata_value

String(1-255 characters)

value for metadata Server Metadata

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{tenant_id}/servers/{server_id}/metadata

Request Header

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

Request Body

  • none

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": {
        "foo": "Foo Value"
    }
}

Execution Example

HTTP Request

GET /v2/895f0b8574504834bd6249d91dbd5a9c/servers/fd2caaa0-cdcb-4f43-bd65-2bdbe29e06b1/metadata HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:cd08bf66ed2044c0ae07458cfeb42e82
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 53
X-Compute-Request-Id: req-03dc59a0-0761-42b1-aa87-463611aefaa0
Date: Thu, 08 Oct 2015 09:48:19 GMT

{"metadata": {"key3": "val3", "key1": "val1_update"}}

Error Execution Example

HTTP Request

GET /v2/s95f0b8574504834bd6249d91dbd5ac/servers/fd2caaa0-cdcb-4f43-bd65-2bdbe29e06b1/metadata HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:cd08bf66ed2044c0ae07458cfeb42e82
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 187
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-4ddc7114-e0bf-4e83-81bb-26acc3d4f157
Date: Thu, 08 Oct 2015 09:56:13 GMT

{"badRequest": {"message": "Malformed request URL: URL's project_id 's95f0b8574504834bd6249d91dbd5ac' doesn't match Context's project_id '895f0b8574504834bd6249d91dbd5a9c'", "code": 400}}