Create Routes
- POST
- /workspaces
- /:workspace
- /distributions
- /:distribution_id
- /routes
Create a new route
Examples
Create a route with external targetCreate a route with artifact targetCreate a route with sandbox targetCreate a route with tunnel target
Example: Create a route with external target
curl -X POST "https://api.buddy.works/workspaces/:workspace/distributions/:distribution_id/routes" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "DIRECT_PROXY",
"subdomain": "api",
"targets": {
"default": {
"type": "EXTERNAL",
"external_url": "https://example.com"
}
},
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}'Example: Create a route with artifact target
curl -X POST "https://api.buddy.works/workspaces/:workspace/distributions/:distribution_id/routes" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "DIRECT_PROXY",
"subdomain": "app",
"targets": {
"default": {
"type": "ARTIFACT",
"artifact": {
"id": "P41GZ4jq",
"version_id": "pzR3j3gN"
}
}
},
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}'Example: Create a route with sandbox target
curl -X POST "https://api.buddy.works/workspaces/:workspace/distributions/:distribution_id/routes" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "DIRECT_PROXY",
"subdomain": "preview",
"targets": {
"default": {
"type": "SANDBOX",
"sandbox": {
"id": "ynjuqe2kov258",
"endpoint": "www"
}
}
},
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}'Example: Create a route with tunnel target
curl -X POST "https://api.buddy.works/workspaces/:workspace/distributions/:distribution_id/routes" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "DIRECT_PROXY",
"subdomain": "dev",
"targets": {
"default": {
"type": "TUNNEL",
"tunnel": {
"agent_id": "j9wYx1vb",
"tunnel_id": "50edvo3Y"
}
}
},
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}'EXAMPLE RESPONSE
{
"url": "https://api.buddy.works/workspaces/my-workspace/distributions/gNYmaWYw/routes/dybEM2bg?project_name=my-project",
"html_url": "https://app.buddy.works/my-workspace/my-project/routing/gNYmaWYw/route/dybEM2bg",
"id": "dybEM2bg",
"type": "DIRECT_PROXY",
"subdomain": "sandbox",
"domain": "buddy.works",
"path": "",
"targets": {
"Default": {
"type": "SANDBOX",
"sandbox": {
"id": "ynjuqe2kov258",
"endpoint": "www"
}
}
},
"note": "Notes about this resource",
"agent_note": "my_custom_field: note for agent"
}STATUS
201 Created