POST /v1/spaces/:space_id/ssh/servers
HTTP Verb: POST
Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity
Object: SSHServer
Location: available
Formats: XML, JSON
Create a SSH server object, returns the newly created SSH server body and its location
Params
To create a SSH server, a data body must be provided. Data can be provided in three formats: XML, JSON and query string. To specify data type of XML or JSON add the Content-type: application/(json|xml) header to request headers, if you want to provide query string simply skip the Content-type header.
All params should be sent in the ssh_server namespace, e.g.:
XML
<ssh_server>
<name>name</name>
...
</ssh_server>
JSON
{"ssh_server":{"name":"name",...}}
Query string
ssh_server[name]=name&...
Check the full list of available params on SSH Server object fields reference
Examples
Request XML, using cURL utility:
curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"ssh_server":{"name":"name","remote_host":"host.com","remote_port":22}}' https://api.assembla.com/v1/spaces/[space_id]/ssh/servers.xml
Response:
HTTP/1.1 201 Created
Date: Tue, 21 May 2013 14:12:36 GMT
Server: Apache
Location: https://api.assembla.com/v1/spaces/_space_id/ssh/servers/1
Status: 201
Vary: Accept-Encoding
Content-Length: 307
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<ssh-tool-server>
<id type="integer">1</id>
<remote-host>host.com</remote-host>
<remote-port type="integer">22</remote-port>
<name>name</name>
<description nil="true"></description>
<space-tool-id>cUIsBcWu0r4P_ceJe9agRk</space-tool-id>
</ssh-tool-server>
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","remote_port":22}}' https://api.assembla.com/v1/spaces/[space_id]/ssh/servers.xml
Response:
HTTP/1.1 201 Created
Date: Tue, 21 May 2013 14:14:39 GMT
Server: Apache
Location: https://api.assembla.com/v1/spaces/_space_id/ssh/servers/2
Status: 201
Content-Length: 125
Content-Type: application/json; charset=utf-8
{
"id":2,
"remote_host":"host.com",
"remote_port":22,
"name":"name",
"description":null,
"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: SSH Server object fields reference