HTTP Verb: POST

Available statuses: 201 Created, 404 Not Found

Object: PrivateSSHKey

Location: available

Formats: XML, JSON

Create a SSH key object, returns the newly created SSH key body and its location. Overrides the old key - it will be deleted.

Params

No params available

Examples

Request XML, using cURL utility:

curl -i -X POST -H "Authorization: Bearer _token" -H "Content-type: application/json" https://api.assembla.com/v1/spaces/[space_id]/ssh/generate_key.xml

Response:

HTTP/1.1 201 Created
Date: Tue, 21 May 2013 15:13:11 GMT
Server: Apache
Location: https://api.assembla.com/v1/spaces/_space_id/ssh/key?format=1
Status: 201
Vary: Accept-Encoding
Content-Length: 818
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<private-ssh-key>
  <id type="integer">1</id>
  <public-content>ssh-dss AAAAB3NzaC1kc3MAAACBAIghC3FqDbHchMN91pcbg4st5HlCfQuLIXm71x8tieBV6UXd855hfGqipPvXSKDASG4pHMwfhPsxHYHNjbGUVQtXMZx+Nyzjoex0R/v3sw7mB7s3d1/iEwQwMKW3nRpLQhDJOGhIUPlrcEZS9Z+98mEWTtZeU1yQK1r3CFkahBzjAAAAFQD0qIYw/1/MQWoQpc8gHYQsI9eSYQAAAIB9eLbYjDGDAlB2tSpdmCkEMsKeFEW9xC79fhWelD2w3+4TXXc8WGzUtqkVprc5EYJJNq3KPO/i/QYBITvAnac7f526UX2M2FXH0erfW/yrf1nmzttWKQ80z6hCPuEt386xy+xVFrnUw7T+fu9WYMdjj0iuTKJBgq6NR15an2c4PAAAAIB9R18Gt3Yhw+5OnVZfKK8+CQXfQ6byjxdWa7gucbnKbdXho193W5YKNCnUMdkiYK39RiFBUFWZ6cmoShHbbjqkYftm2LJOoTZSIfKM3KZYK0aCWqEflT+/ZZ8FgazsR7u8hEmchI/IgjjlnpeH/+KXP1+4kXiyh/rGZXeGo8Wnlw== _space_id@www.assembla.com
  </public-content>
  <space-tool-id>cUIsBcWu0r4P_ceJe9agRk</space-tool-id>
</private-ssh-key>

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"ssh_server":{"name":"name","remote_host":"host.com","host_port":22}}' https://api.assembla.com/v1/spaces/[space_id]/ssh/servers.xml

Response:

HTTP/1.1 201 Created
Date: Tue, 21 May 2013 15:16:20 GMT
Server: Apache
Location: https://api.assembla.com/v1/spaces/_space_id/ssh/key?format=1
Status: 201
Content-Length: 692
Content-Type: application/json; charset=utf-8

{
  "id":1,
  "public_content":"ssh-dss AAAAB3NzaC1kc3MAAACBALK3OE+rR94WjyFJC3WqFcOgWj7SVOV4XS4fwvPQbffO0hHHPbRwoDpfYb6Viv6G4qldzl9OinT5BK5iqGQR3ifEPXbwi5UDKpoWeE1yyL44eJ8X/Kn9O+5lTUXg7rKjBgbcL/wqa9VO/ZvinO4ZyXOuQOYoLoqO2wmcpW6aeKlZAAAAFQChr6FTi5P9vR3bFW5b5kWa772ZSwAAAIAKrdjAKoa8z5C3HfBwESoRzuGAfBmB2Bi9+wpY9EGK6gBOc4MIpTV+jke3CNTJiqgXCcRJPNhqgo9Ke+1cySCxUXsgh116n0rGPjhMh2r7919+2OaqXEvHONm7Yua5Unx6mR/fqCvCjsELCsikfrOZLXWEd1A81HOH2Zz8W1B5xAAAAIEAmyP4X4/li5CIh1B00o2tI+kE9SvyWCgWl8Li0C+v4gL+4A/S8R1M/77XrqN0pkRNXH9BZeVdPWfyOFmX/BPxGoUKjNEfDEUOOFJ7SooGAB9qYGuQpYcvEpwIu2i+MbV80RASfK9d2jbK/9MTW7cOagyOi/FtevCI60kpridWrqk= _space_id@www.assembla.com\n",
  "space_tool_id":"cUIsBcWu0r4P_ceJe9agRk"
}

JSON is formatted here for readability, in a real response JSON body is inline with no indentation.

Note: pay attention to Location header, this is the URL where newly created resource is located, you can GET on this URL to access this resource.

Description for each field: Space SSH Key object fields reference