Creating a Route
POST /v2/routes/
Request
Route
POST /v2/routes
Parameters
Name |
Description |
Valid Values |
Example Values |
generate_port
|
Set to `true` to generate a random port. Defaults to `false`. Supported for domains for TCP router groups only. Takes precedence over manually specified port.
|
|
|
Body
Name |
Description |
Default |
Valid Values |
Example Values |
domain_guid
|
The guid of the associated domain
|
|
|
- guid-8c1fc0b6-87a3-4745-8f98-c62edc191ec4
|
space_guid
|
The guid of the associated space
|
|
|
- guid-64b9d3b1-fed4-4a19-9835-c32027faf5aa
|
host
|
The host portion of the route
|
|
|
|
port
|
The port of the route. Supported for domains of TCP router groups only.
|
|
|
|
path
|
The path for a route as raw text. 1) Paths must be between 2 and 128 characters 2) Paths must start with a / 3) Paths must not contain a "?"
|
|
|
- /apps/v1/path
- /apps/v2/path
|
{
"domain_guid": "fa67eb75-d3db-4fa9-8e84-8d44792ebd0e",
"space_guid": "1236e22b-3e78-4e2e-8bc5-8f7613520dda",
"port": 10000
}
Headers
cURL
curl "https://api.[your-domain.com]/v2/routes" -d '{
"domain_guid": "fa67eb75-d3db-4fa9-8e84-8d44792ebd0e",
"space_guid": "1236e22b-3e78-4e2e-8bc5-8f7613520dda",
"port": 10000
}' -X POST \
-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM5NSIsImVtYWlsIjoiZW1haWwtMjY2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTMzMTA5OTB9.9DrT983C01zlDTHzwrNlSlQak39D9urkAUEEP0mY1jw" \
-H "Host: example.org" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Cookie: "
Response
Status
201 Created
Body
{
"metadata": {
"guid": "3d93fe03-4bec-4d8a-8b3d-f61dd62e70a0",
"url": "/v2/routes/3d93fe03-4bec-4d8a-8b3d-f61dd62e70a0",
"created_at": "2016-01-13T17:29:50Z",
"updated_at": null
},
"entity": {
"host": "",
"path": "",
"domain_guid": "fa67eb75-d3db-4fa9-8e84-8d44792ebd0e",
"space_guid": "1236e22b-3e78-4e2e-8bc5-8f7613520dda",
"service_instance_guid": null,
"port": 10000,
"domain_url": "/v2/domains/fa67eb75-d3db-4fa9-8e84-8d44792ebd0e",
"space_url": "/v2/spaces/1236e22b-3e78-4e2e-8bc5-8f7613520dda",
"apps_url": "/v2/routes/3d93fe03-4bec-4d8a-8b3d-f61dd62e70a0/apps"
}
}
Headers