Create a new config file via API
This method allows you to create a new config file.
Tip: You can explore and test this endpoint interactively using our OpenAPI documentation.
URL
/projects/<project>/config_files
Replace <project> with either the permalink or identifier 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 ofserver_identifiers(optional)server_identifiers- An array of server identifiers that the config file should be uploaded to (optional). It can include server group identifiers.
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",
"description": "Database configuration",
"path": "config/database.yml",
"body": "**content**",
"build": false,
"servers": [
{
"id": 12345,
"identifier": "16d48756-20f0-1fa0-ac12-9dffb67054c0",
"name": "Development Server",
"protocol_type": "ssh"
}
],
"url": "https://test.deployhq.com/projects/my-project/config_files/19c8d0df-0ab9-2f1f-1a4b-5aec4c37c7b7"
}