Chapter 5. SSH Keys
Name | Description |
---|---|
name | Name of the SSH key as specific by the user. |
content | Content of the public SSH key. |
type | Type of SSH key; for example, RSA or DSA. . |
5.1. Add SSH Key
Add an SSH key to the specified user account.
Method Resource URL POST
/broker/rest/user/keys
Name Description Required Default name
Name of key Yes type
Type of SSH key Yes content
The key portion (excluding ssh-rsa and comment) Yes
{ "name": "mysshkey", "type": "ssh-rsa", "content": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDBJHobjmzxy8cv9A1xw9X5TlnQd0bW/19FwOC0c6jPNu9ZbtWQcAE0xfODl7ZqVPPU2qAFOh4rbL3gL2UzTyA+NwERyDrH7tMXAoXPT2L6sqExl0xxuEvb/lXUfLquMq+BMOFxxqCEg8X7GavHN72FMUHwweNybE7C82So+OFSWqFoctiWMNdNsKW4lvBd/jkIudGdRdK+/PzV75TW1LcpfsBrFOJZbd5WzDJEPNdMqOH68YDExD82VtzeJm0HEavhMY9HtxIDEmjIhtfedzCGZLe+6OxReuatw6M+n1sFxT9liprZ6NIANvbnYZKGT50hYfnIi/hZOTCvqYNS97O3" }
$ curl -X POST https://openshift.redhat.com/broker/rest/user/keys --user user@example.com:password --data-urlencode name=mysshkey --data-urlencode type=ssh-rsa --data-urlencode content=AAAAB3NzaC1yc2EhyuiBIwAAAQEA14PDPWsaZMDspZNK7ABsppzwy++Ih2tRwjBkxzC2KEcQi7v8IcyODb7qLJ72tgx3G90zRm7vQ6wuyy7rkYLIvTYiDnchy68ikjyt7wuBuSCgFcHLUdon7xn7VrskjhMN4pae6bjaY1+o4Knpfm3N72+9q/6+T52QIWCE1+Ku6UYYuOGy8qWynddw24bp4jGEKAXqTXcALuBoukC3uB+hrxvZYH1fbek6aEAQPYzO6sGqJqV1UoF0ascelhtyui8kadrKPr/5uJsPS+kGZguU16ykQb2k9K03JMSfvPP4rLe50Q9G4dSZFbUOQXdC3n13CqvsEVzizUGl0HyT8MhRqw==
The API returns the key resource. Unnecessary information and related resource links returned by the API have been removed for brevity. See Chapter 5, SSH Keys for more information on all SSH key parameters.
{ "api_version": 1.6, "data": { "content": "AAAAB3NzaC1yc2EhyuiBIwAAAQEA14PDPWsaZMDspZNK7ABsppzwy++Ih2tRwjBkxzC2KEcQi7v8IcyODb7qLJ72tgx3G90zRm7vQ6wuyy7rkYLIvTYiDnchy68ikjyt7wuBuSCgFcHLUdon7xn7VrskjhMN4pae6bjaY1+o4Knpfm3N72+9q/6+T52QIWCE1+Ku6UYYuOGy8qWynddw24bp4jGEKAXqTXcALuBoukC3uB+hrxvZYH1fbek6aEAQPYzO6sGqJqV1UoF0ascelhtyui8kadrKPr/5uJsPS+kGZguU16ykQb2k9K03JMSfvPP4rLe50Q9G4dSZFbUOQXdC3n13CqvsEVzizUGl0HyT8MhRqw", "name": "mysshkey", "type": "ssh-rsa" }, "messages": [ { "exit_code": 0, "field": null, "severity": "info", "text": "Created SSH key mysshkey" } ], "status": "created", "supported_api_versions": [ 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 ], "type": "key", "version": "1.6" }