Header

Create a new config file via API

This method allows you to create a new config file.

URL

/projects/<project>/config_files

Replace <project> with the permalink of the project.

HTTP Method

POST

Supported Parameters

  • path - Enter the full path to the file starting from the root of deployed area (required)
  • body - Full contents of the file which you wish to be uploaded when you deploy (required)
  • all_servers - If the command should be run on all servers set to true, otherwise send an array of server_identifiers (optional)
  • server_identifiers - An array of server identifiers that the config file should be uploaded to (optional)

Example cURL Request

curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user adam@atechmedia.com:my-api-key \
-X POST \
-d { \
  "config_file" : { \
    "path": "config/database.yml", \
    "body" : "content", \
    "all_servers" : true, \
    "server_identifiers" : [identifier_one, identifier_two] \
  } \
} \
https://test.deployhq.com/projects/project/config_files

Example Response

{
    "identifier": "19c8d0df-0ab9-2f1f-1a4b-5aec4c37c7b7",
    "path": "config/database.yml",
    "body": "**content**",
    "servers": [
        {
            "identifier": "16d48756-20f0-1fa0-ac12-9dffb67054c0",
            "name": "Development Server",
            "protocol_type": "ssh",
            "server_path": "/home/deploy",
            "auto_deploy_url": "https://test.deployhq.com/deploy/codebase/to/development-server/fnxn0be32syo",
            "last_revision": "2aab5da1a6ae04a1e943d55213465d28056d5bc2",
            "preferred_branch": "master",
            "notify_email": false,
            "server_group_identifier": null,
            "hostname": "127.0.0.1",
            "port": 22,
            "username": "deploy",
            "use_ssh_keys": false,
            "host_key": "AAAAB3NzaC1yc2EAAAA....."
        }
    ]
}
Tree

Proudly powered by Katapult. Running on 100% renewable energy.