Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Children Display
alltrue
styleh3
pageSuperb Cloud API

POST /settings/ssh_keys 

Adds SSH key to your account

Sections:

Table of Contents
maxLevel4
minLevel2
includeResponse.*|JSON.*|XML.*

Request Parameters

key* - a SSH key in the following format: ssh-[type] [ascii-symbols allowed for base64 string] [user credentials]

Response Parameters

Info

201 Status and SSH key object returned on success

JSON Request example

Code Block
languagebash
themeRDark
 curl -X POST -u user:userpass <api_url>/users/:user_id/ssh_keys.json -H 'Accept: application/json' -H 'Content-type: application/json' -d'{"ssh_key":{"key":"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAqzsLk+oPP9Qxz0Xgpqoe9DqNV7Qe3+oig/o6Ubt30Yh+Zarf8NXctqqeamC1KrlMt12d0AWd38dZ0CU6Eru/2ciwzz2IB0MLrTyjfLCNe2CW64uNjhSS1SH6gSjJUYwHSi7jUBl0vlGtJ7jswBdhgaKkjk1vXH3YFLTHPuKU+pc= user@superb.test"}}'

JSON Response

Code Block
themeRDark
 [
    {
        "ssh_key": {
            "created_at": "2015-10-16T22:48:04+00:00",
            "id": 4,
            "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAoBx7WYEVrzPxYdf77p2xSon2x9hfW/cVgi2+Q1ijpSyzb/oPHmE/3ae23k0oOGEt61xBLRrpig/oY8YHj7MZSZ/rY3n43iYrMpTVYkqB/f+Tww0t9ozdmWfo0kgItyOO6Psel2x28X0847XAZ++nKFKXxGRlXOf8+o3wXvIb7YWuTN/m1AP8Deh5RsY/Xqf6V0y7OMc3/ndVGaWrp9HxfPMLrZFK/cCBhwCkUlAyXbYg9W3kmBEKCrvU1yv9qJr4i61iB8KNeYKpce/CpKri5Ln4peQXtlj5fsLZsuBUKFJb7Dr5DxiVugE+B1RTD4JmBIXSwb7uFt7vwd6P107ztQ== rsa-key-20151016",
            "updated_at": "2015-10-16T22:48:04+00:00",
            "user_id": 123
        }
    }
]

XML Request example

Code Block
languagebash
themeRDark
 curl -X POST -u user:userpass <api_url>/users/:user_id/ssh_keys.xml -H 'Accept: application/xml' -H 'Content-type: application/xml' -d'<ssh_key><key> ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAqzsLk+oPP9Qxz0Xgpqoe9DqNV7Qe3+oig/o6Ubt30Yh+Zarf8NXctqqeamC1KrlMt12d0AWd38dZ0CU6Eru/2ciwzz2IB0MLrTyjfLCNe2CW64uNjhSS1SH6gSjJUYwHSi7jUBl0vlGtJ7jswBdhgaKkjk1vXH3YFLTHPuKU+pc= user@superb.test</key></ssh_key>'

XML Response example

Code Block
languagexml
themeRDark
 <?xml version="1.0" encoding="UTF-8"?>
<ssh_key>
  <created_at type="datetime">2015-10-17T00:10:36+00:00</created_at>
  <id type="integer">6</id>
  <key>ssh-rsa 1AAAB3NzaC1yc2EAAAABJQAAAQEAoBx7WYEVrzPxYdf99p2xSon2x9hW/cVgi2+Q1ijpSyzb/oPHmE/3ae23k0oOGEt6zxBLRrpig/oY8YHj7MZSZ/rY3n43iYrMpTVYkqB/f+Tww0t9ozdmWfo0kgItyOO6Psel2x28X0847XAZ++nKFKXxGRlXOf8+o3wXvIb7YWuTN/m1AP8Deh5RsY/Xqf6V0y7OMc3/ndVGaWrp9HxfPMLrZFK/cCBhwCkUlAyXbYg9W3kmBEKCrvU1yv9qJr4i61iB8KNeYKpce/CpKri5Ln4peQXtlj5fsLZsuBUKFJb7Dr5DxiVugE+B1RTD4JmBIXSwb7uFt7vwd6P107ztQ== rsa-key-20151016</key>
  <updated_at type="datetime">2015-10-17T00:10:36+00:00</updated_at>
  <user_id type="integer">13</user_id>
</ssh_key>