Create a server via API (templates)
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, eitherftp,ftps,rackspace,s3orssh(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, eithernever,failureoralways(required)auto_deploy- Should auto deployments be enabled, eithertrueorfalse(required)notification_email- Custom notification e-mail address, leave blank to use the user who started the deployment's addressenvironment- 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 21passive-trueorfalseforce_hidden_files-trueorfalse
FTPS
In addition to the FTP parameters the following parameters are available for FTPS servers.
implicit-trueorfalseignore_certificate_errors-trueorfalse
SSH/SFTP
hostname(required)username(required)password(required)port- default 22use_ssh_keys-trueorfalse
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
}