Header

Create a server

This method allows you to add a new server to a project template.

URL

/templates/<permalink>/servers
  • Replace <permalink> with the permalink of your template.

HTTP Method

POST

Supported Parameters

  • name - Friendly name for your server (required)
  • protocol_type - Connection protocol, either ftp, ftps, rackspace, s3 or ssh (required)
  • server_path - Where on the server should your files be placed (for example, public_html/ or /absolute/path/here)
  • email_notify_on - When do you want to receive email notifications, either never, failure or always (required)
  • auto_deploy - Should auto deployments be enabled, either true or false (required)
  • notification_email - Custom notification e-mail address, leave blank to use the user who started the deployment's address
  • environment - Production, Testing, Development etc. can be substituted into SSH commands.
  • server_group_identifier - The server group that this server belongs to

In addition to the above parameters, the following parameters are available depending on the protocol selected:

FTP

  • hostname (required)
  • username (required)
  • password (required)
  • port - default 21
  • passive - true or false
  • force_hidden_files - true or false

FTPS

In addition to the FTP parameters the following parameters are available for FTPS servers.

  • implicit - true or false
  • ignore_certificate_errors - true or false

SSH/SFTP

  • hostname (required)
  • username (required)
  • password (required)
  • port - default 22
  • use_ssh_keys - true or false

Amazon S3

  • bucket_name - (required)
  • access_key_id - (required)
  • secret_access_key - (required)

Rackspace Cloud

  • username - (required)
  • api_key - (required)
  • region - (required)
  • container_name - (required)

Example cURL Request

curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user adam@atechmedia.com:my-api-key \
-X POST \
-d { \
  "server" : { \
    "name": "Development", \
    "protocol_type" : "ftp", \
    "hostname": "files.000webhost.com", \
    "username": "deployhqtest", \
    "password": "test", \
    "server_path":"pubic_html" \
  } \
} \
https://atech.deployhq.com/templates/api-created/servers

Example response

{
  "id":832885,
  "identifier":"32dbff13-dceb-4351-84e2-5db4a4531b32",
  "name":"FTP server",
  "protocol_type":"ftp",
  "server_path":"public_html",
  "last_revision":null,
  "preferred_branch":null,
  "branch":null,
  "notify_email":null,
  "server_group_identifier":null,
  "auto_deploy":false,
  "hostname":"files.000webhost.com",
  "username":"deployhqtest",
  "port":21
}