Get console

Overview

Gets a console for a server instance.

Classification

  • Show

API Operation Object

  • action

Synchronous / Asynchronous

  • synchronous

Request

HTTP Request Method

  • POST

HTTP Request Path

{api_endpoint}/v2/{project_id}/servers/{server_id}/action

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

{
    "os-getVNCConsole": {
        "type": "<vnc_type>"
    }
}

Request Parameter

Request Parameters
name style format description required/optional default value action for invalid parameter response code for invalid parameter
project_id URL UUID(3) Project id required - Terminate 400, 404
server_id URL UUID String instance id required - Terminate 404
token_id Header authentication token string keystone authentication token required - Terminate 401
vnc_type Body String(“novnc”, “xvpvnc”) type of vnc required - Terminate 400

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 invalid the project_id
- invalid vnc_type
401 unauthorized
404 not found a specified instance
409 not found a specified project
- instance not yet ready(invalid host of instance)
501 vnc console isn’t implemented

HTTP Response Body

Format

{
    "console": {
        "type": "<vnc_type>",
        "url": "<console_URL>"
    }
}

Response Parameter

Response Parameters
item format description
vnc_type String: novnc or xvpvnc type of vnc
console_URL URL console URL

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{project_id}/servers/{server_id}/action

Request Header

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

Request Body

{
    "os-getVNCConsole": {
        "type": "<vnc_type>"
    }
}

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

{
     "console": {
         "type": "<vnc_type>",
         "url": "<console_URL>"
     }
 }

Execution Example

HTTP Request

POST /v2/1ab83fbf1b594600bfa618dc33694dd6/servers/365313c5-5d0c-4c43-af05-16f765c0f2bc/action HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.150.51:8774
Accept-Encoding: gzip, deflate, compress
Accept: application/json
X-Auth-Token: 50c17af54c154f528d135e7f74098cfd
Content-Type: application/json
Content-Length: 42

{ "os-getVNCConsole": { "type": "novnc" }}

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 124
X-Compute-Request-Id: req-f37e98ac-1593-40b2-913c-0f08d7e80323
Date: Tue, 19 Aug 2014 05:40:40 GMT

{"console": {"url": "http://192.168.155.51:6080/vnc_auto.html?token=075023ba-ccd3-4c4b-a15d-7efc0319a9df", "type": "novnc"}}

Error Execution Example

HTTP Request

POST /v2/895f0b8574504834bd6249d91dbd5a9c/servers/fd2caaa0-cdcb-4f43-bd65-2bdbe29e06b1/action HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:e2f9b4b1648c4d7eb890fce86598c706
Accept: application/json
Content-Length: 39
Content-Type: application/x-www-form-urlencoded

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 73
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-7cbbf616-b17b-43e2-82a4-fba41dbaea24
Date: Thu, 08 Oct 2015 09:16:27 GMT

{"badRequest": {"message": "There is no such action: None", "code": 400}}