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",
"pipelines_access_level": "DENIED",
"environments_access_level": "DENIED",
"scope": "PROJECT",
"base_only": false,
"allow_decrypted_values": 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"
],
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}'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",
"pipelines_access_level": "READ_ONLY",
"environments_access_level": "READ_ONLY",
"scope": "WORKSPACE",
"base_only": false,
"allow_decrypted_values": false,
"allowed_pipelines": [
{
"project": "my-project",
"pipeline": "Deploy to Production"
}
],
"allowed_environments": [
{
"project": "my-project",
"environment": "staging"
}
],
"base_environments": [
"staging",
"development"
],
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}'EXAMPLE RESPONSE
{
"url": "https://api.buddy.works/workspaces/my-workspace/projects/environments/3a4KbBQl",
"html_url": "https://app.buddy.works/my-workspace/my-project/environments/environment/3a4KbBQl",
"id": "3a4KbBQl",
"name": "Development Environment",
"identifier": "dev",
"tags": [
"development",
"dev"
],
"icon": "development.svg",
"public_url": "https://env.myproduct.com",
"pipelines_access_level": "DENIED",
"environments_access_level": "DENIED",
"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://app.buddy.works/my-workspace/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://app.buddy.works/my-workspace/my-project/environments/environment/3a4KbBQl/targets/abc123/edit",
"id": "abc123",
"identifier": "dev-server",
"type": "SSH"
}
],
"base_only": false,
"allow_decrypted_values": false,
"scope": "PROJECT",
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}STATUS
201 Created