Edit an existing command via API
This method allows you to edit an existing SSH command.
URL
/projects/<project>/commands/<identifier>
- Replace
<project>
with thepermalink
of the project. - Replace
<identifier>
with theidentifier
of the command.
HTTP Method
PUT
Supported Parameters
description
- The description of the command (required)command
- The actual command (required)cback
- When the command should be run (required)before_changes
- Before changes have been uploadedafter_changes
- After changes have been uploaded
timing
- Run on one of the following (required)all
- All deploymentsfirst
- Only on the first deployment to the serverafter_first
- Only after the first deployment to the server
halt_on_error
- If DeployHQ should half a deployment if a command fails to run (optional)server_identifiers
- An array of server identifiers that the command should be run on (optional)all_servers
- If the command should be run on all servers set to true, otherwise send an array ofserver_identifiers
(optional)timeout
- A timeout for how long the SSH command should be run (required), the following options are permitted and must be provided as an integer as a number of seconds300
- 300 seconds (5 minutes)1800
- 1800 seconds (30 minutes)3600
- 3600 seconds (1 hour)5400
- 5400 seconds (90 minutes)
Example cURL Request
curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user adam@atechmedia.com:my-api-key \
-X PUT \
-d { \
"command" : { \
"description": "Test command", \
"command" : "echo test;", \
"all_servers" : true, \
"timing" : "all", \
"timeout" : 300, \
"cback" : "after_changes", \
} \
} \
https://test.deployhq.com/projects/project/commands/82204198-e157-86bc-0911-0fcd5f25f4ec
Example Response
{
"identifier": "82204198-e157-86bc-0911-0fcd5f25f4ec",
"cback": "before_changes",
"position": 5,
"description": "Description",
"command": "**command**",
"halt_on_error": false,
"servers": [
{
"identifier": "16d48756-20f0-1fa0-ac12-9dffb67054c0",
"name": "Hello",
"protocol_type": "ssh",
"server_path": "/tmp",
"auto_deploy_url": "https://test.deploy.dev/deploy/gitlab/to/ll/fnxn0be32syo",
"last_revision": "2aab5da1a6ae04a1e943d55213465d28056d5bc2",
"preferred_branch": "master",
"notify_email": false,
"server_group_identifier": null,
"hostname": "185.22.208.148",
"port": 22,
"username": "root",
"use_ssh_keys": false,
"host_key": "AAAAB3NzaC1yc2EAAAA..."
}
],
"timing": "all"
}