Create
- POST
- /workspaces
- /:workspace
- /environments
Creates a new environment in the workspace.
Request example
curl -X POST "https://api.buddy.works/workspaces/:workspace/environments" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"identifier": "stage_env",
"name": "Staging environment",
"scope": "PROJECT",
"project": {
"name": "company-website"
},
"icon": "rocket",
"tags": [
"staging",
"tag1"
],
"public_url": "http://staging.com",
"base_only": false,
"variables": [
{
"key": "myVar1",
"value": "myValue1",
"type": "VAR",
"settable": true,
"encrypted": false,
"description": "some variable1"
}
],
"permissions": {
"others": "DENIED",
"users": [
{
"id": 1,
"access_level": "MANAGE"
}
],
"groups": [
{
"id": 2,
"access_level": "USE_ONLY"
}
]
},
"all_pipelines_allowed": false,
"allowed_pipelines": [
{
"project": "company-website",
"pipeline": "deploy-prod"
}
],
"all_environments_allowed": false,
"allowed_environments": [
{
"project": "company-website",
"environment": "development"
}
]
}'Response
EXAMPLE RESPONSE{ "url": "https://api.buddy.works/workspaces/buddy/environments/9DBbgP4q", "html_url": "https://app.buddy.works/buddy/environments/environment/9DBbgP4q", "id": "9DBbgP4q", "name": "Staging environment", "identifier": "stage_env", "scope": "PROJECT", "icon": "rocket", "tags": [ "staging", "tag1" ], "public_url": "http://staging.com", "base_only": false, "base_environments": [], "all_pipelines_allowed": false, "allowed_pipelines": [ { "project": "company-website", "pipeline": "deploy-prod" } ], "all_environments_allowed": false, "allowed_environments": [ { "project": "company-website", "environment": "development" } ], "project": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website", "html_url": "https://app.buddy.works/buddy/company-website", "name": "company-website", "display_name": "Company Website" }, "variables": [ { "id": 1, "key": "myVar1", "value": "myValue1", "type": "VAR", "settable": true, "run_only_settable": false, "description": "some variable1" } ], "permissions": { "others": "DENIED", "users": [ { "id": 1, "access_level": "MANAGE" } ], "groups": [ { "id": 2, "access_level": "USE_ONLY" } ] } }
STATUS201 Created