Examples
Example: Create a new environment in a project
curl -X POST "https://api.buddy.works/workspaces/:workspace/environments" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Environment",
"identifier": "prod-env",
"tags": [
"production",
"stable"
],
"icon": "production.svg",
"public_url": "https://prod.example.com",
"all_pipelines_allowed": false,
"all_environments_allowed": false,
"scope": "PROJECT",
"base_only": false,
"project": {
"name": "my-project"
},
"allowed_pipelines": [
{
"project": "my-project",
"pipeline": "Deploy to Production"
}
],
"allowed_environments": [
{
"project": "my-project",
"environment": "staging"
}
],
"base_environments": [
"staging",
"development"
]
}'Example: Create a new environment in a workspace
curl -X POST "https://api.buddy.works/workspaces/:workspace/environments" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "Staging Environment",
"identifier": "staging-env",
"tags": [
"staging",
"testing"
],
"icon": "staging.svg",
"public_url": "https://staging.example.com",
"all_pipelines_allowed": true,
"all_environments_allowed": true,
"scope": "WORKSPACE",
"base_only": false,
"allowed_pipelines": [
{
"project": "my-project",
"pipeline": "Deploy to Production"
}
],
"allowed_environments": [
{
"project": "my-project",
"environment": "staging"
}
],
"base_environments": [
"staging",
"development"
]
}'EXAMPLE RESPONSE{ "url": "https://api.buddy.works/workspaces/my-workspace/projects/environments/3a4KbBQl", "html_url": "https://my-workspace.buddy.works/environments/environment/3a4KbBQl", "id": "3a4KbBQl", "name": "Development Environment", "identifier": "dev", "tags": [ "development", "dev" ], "icon": "development.svg", "public_url": "https://env.myproduct.com", "all_pipelines_allowed": false, "all_environments_allowed": false, "allowed_pipelines": [ { "project": "my-project", "pipeline": "Deploy to Dev" } ], "allowed_environments": [ { "project": "my-project", "environment": "staging" } ], "create_date": "2024-01-15T10:30:00Z", "project": { "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project", "html_url": "https://my-workspace.buddy.works/projects/my-project", "name": "my-project", "display_name": "My Project" }, "permissions": { "others": "USE_ONLY", "users": [ { "id": 123, "access_level": "MANAGE" } ], "groups": [ { "id": 456, "access_level": "READ_WRITE" } ] }, "base_environments": [ "production", "staging" ], "targets": [ { "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/targets/123", "html_url": "https://my-workspace.buddy.works/my-project/targets/123", "id": "abc123", "identifier": "dev-server", "type": "SSH" } ], "base_only": false, "scope": "PROJECT" }
STATUS201 Created