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": "PROXY",
"subdomain": "api",
"targets": {
"default": {
"type": "EXTERNAL",
"external_url": "https://example.com"
}
}
}'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": "PROXY",
"subdomain": "app",
"targets": {
"default": {
"type": "ARTIFACT",
"artifact": {
"id": "P41GZ4jq",
"version_id": "pzR3j3gN"
}
}
}
}'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": "PROXY",
"subdomain": "preview",
"targets": {
"default": {
"type": "SANDBOX",
"sandbox": {
"id": "ynjuqe2kov258",
"endpoint": "www"
}
}
}
}'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": "PROXY",
"subdomain": "dev",
"targets": {
"default": {
"type": "TUNNEL",
"tunnel": {
"id": "yZ8xW7vU",
"tunnel_id": "rS5tP4oN"
}
}
}
}'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": "PROXY", "subdomain": "sandbox", "domain": "buddy.works", "path": "", "targets": { "Default": { "type": "SANDBOX", "sandbox": { "id": "ynjuqe2kov258", "endpoint": "www" } } } }
STATUS201 Created