HTTP Verb: POST

Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity

Object: SSHKey

Location: available

Formats: XML, JSON

Creates a SSH key.

Params

To create a SSH key, a data body must be provided. Data can be provided with request body in application/x-www-form-urlencoded or query string format

key=ssh-dss+AAAAB3NzaC1kc3MAAACBAInHanOeK....&title=desktop&read_only=true

JSON

{
    "key": "ssh-dss+AAAAB3NzaC1kc3MA....",
    "title": "desktop",
    "read_only": false
}

XML

<ssh-key>
  <title>desktop@home</title>
  <read-only type="boolean">true</read-only>
  <key>ssh-dss AAAAB....CnTZSw== op@m06</key>
</ssh-key>

Examples

For example purposes, we use a JSON body

{"key":"ssh-dss+AAAAB3NzaC1kc3MA....", "title":"title goes here"}

Request XML, using cURL utility:

curl -i -X POST -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"key":"ssh-dss+AAAAB3NzaC1kc3MA....", "title":"title goes here"}' https://api.assembla.com/v1/user/ssh_keys.xml

Response:

HTTP/1.1 201 Created
Content-Type: application/xml; charset=utf-8
Status: 201
Location: https://api.assembla.com/v1/user/ssh_keys/2
...

<?xml version="1.0" encoding="UTF-8"?>
<ssh-key>
  <id type="integer">7</id>
  <finger-print>f4692acd0962772397f25daeadb27361</finger-print>
  <title>desktop@home</title>
  <read-only type="boolean">false</read-only>
  <key>ssh-dss AAAAB....CnTZSw== op@m06</key>
</ssh-key>

Request JSON, using cURL utility:

curl -i -X POST -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"key":"ssh-dss+AAAAB3NzaC1kc3MA....","title":"title goes here"}' https://api.assembla.com/v1/user/ssh_keys.json

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
Status: 201
Location: https://api.assembla.com/v1/user/ssh_keys/2
...

{
"finger_print":"f4692acd0962772397f25daeadb27361",
"title":"desktop@home",
"read_only":false,
"id":8,
"key":"ssh-dss AAAAB3N...nTZSw== op@m06\n"
}

Description for each field: SSHKey object fields reference