Show keypair information¶
Overview¶
Shows a keypair associated with the account.
Classification¶
- Show
API Operation Object¶
- os-keypairs
Synchronous / Asynchronous¶
- -
Request¶
HTTP Request Method¶
- GET
HTTP Request Path¶
{api_endpoint}/v2/{tenant_id}/os-keypairs/{keypair_name}
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”
HTTP Response Body¶
Format¶
{
"keypair": {
"created_at": "<created_at>",
"deleted": <deleted>,
"deleted_at": <deleted_at>,
"fingerprint": "<fingerprint>",
"id": <id>,
"name": "<name>",
"public_key": "<public_key>",
"updated_at": <updated_at>,
"user_id": "<user_id>"
}
}
Response Parameter¶
item | format | description |
---|---|---|
created_at | time/date | Date and time when the keypair was created. |
deleted | boolean/String(‘t’,’true’, ‘on’, ‘y’, ‘yes’, ‘1’,’f’, ‘false’, ‘off’, ‘n’, ‘no’, ‘0’) | keypair deletion flag |
deleted_at | time/date | Date and time when the keypair was deleted. |
fingerprint | String | fingerprint |
id | String | keypair id |
name | String | The name to associate with the keypair. |
public_key | String | The public ssh key to import. If not provided, a key is generated. |
updated_at | time/date | update time |
user_id | String | owner of instance |
Sample API Request and Response¶
Sample API Request¶
Request URI¶
https://example.com/v2/{tenant_id}/os-keypairs/{keypair_name}
Request Header¶
Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: ajk3adjiown02
Content-Type: application/json
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¶
{
"keypair": {
"created_at": "2014-05-07T12:06:13.681238",
"deleted": false,
"deleted_at": null,
"fingerprint": "9d:00:f4:d7:26:6e:52:06:4c:c1:d3:1d:fd:06:66:01",
"id": 1,
"name": "keypair-3582d8b7-e588-4aad-b7f7-f4e76f0e4314",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYJrTVpcMwFqQy/oMvtUSRofZdSRHEwrsX8AYkRvn2ZnCXM+b6+GZ2NQuuWj+ocznlnwiGFQDsL/yeE+/kurqcPJFKKp60mToXIMyzioFxW88fJtwEWawHKAclbHWpR1t4fQ4DS+/sIbX/Yd9btlVQ2tpQjodGDbM9Tr9/+/3i6rcR+EoLqmbgCgAiGiVV6VbM2Zx79yUwd+GnQejHX8BlYZoOjCnt3NREsITcmWE9FVFy6TnLmahs3FkEO/QGgWGkaohAJlsgaVvSWGgDn2AujKYwyDokK3dXyeX3m2Vmc3ejiqPa/C4nRrCOlko5nSgV/9IXRx1ERImsqZnE9usB Generated-by-Nova\n",
"updated_at": null,
"user_id": "fake"
}
}
Execution Example¶
HTTP Request¶
GET /v2/895f0b8574504834bd6249d91dbd5a9c/os-keypairs/keypair-dab428fe-6186-4a14-b3de-92131f76cd39 HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:aa8d8ee4622c4e10ace2a5a16b58caf2
Content-type: application/json
Accept: application/json
HTTP Response¶
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 541
X-Compute-Request-Id: req-ad4e294b-b847-4c7e-bde0-7fe12ee1ce37
Date: Thu, 08 Oct 2015 00:58:23 GMT
{"keypair": {"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova", "user_id": "28f204a985194a2bae3162c4e89df8f1", "name": "keypair-dab428fe-6186-4a14-b3de-92131f76cd39", "deleted": false, "created_at": "2015-10-08T00:48:42.000000", "updated_at": null, "fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c", "deleted_at": null, "id": 1}}
Error Execution Example¶
HTTP Request¶
GET /v2/895f0b8574504834bd629d91dbd5a9c/os-keypairs/keypair-dab428fe-6186-4a14-b3de-92131f76cd39 HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:aa8d8ee4622c4e10ace2a5a16b58caf2
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-fe07cd87-e507-49b0-8a06-a7602a2c15e9
Date: Thu, 08 Oct 2015 00:59:24 GMT
{"badRequest": {"message": "Malformed request URL: URL's project_id '895f0b8574504834bd629d91dbd5a9c' doesn't match Context's project_id '895f0b8574504834bd6249d91dbd5a9c'", "code": 400}}