Edit a server via API (templates)
This method allows you to add a new server to a project template.
URL
/templates/<permalink>/servers/<identifier>
- Replace
<permalink>
with the permalink of your template. - Replace
<identifier>
with the identifier of your template.
HTTP Method
PUT
Supported Parameters
name
- Friendly name for your server (required)protocol_type
- Connection protocol, eitherftp
,ftps
,rackspace
,s3
orssh
(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
,failure
oralways
(required)auto_deploy
- Should auto deployments be enabled, eithertrue
orfalse
(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
-true
orfalse
force_hidden_files
-true
orfalse
FTPS
In addition to the FTP parameters, the following parameters are available for FTPS servers.
implicit
-true
orfalse
ignore_certificate_errors
-true
orfalse
SSH/SFTP
hostname
(required)username
(required)password
(required)port
- default 22use_ssh_keys
-true
orfalse
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 PUT \
-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/32dbff13-dceb-4351-84e2-5db4a4531b32
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
}