Home
Version 3
Routes API

Routes API

Creating a Route

POST /v2/routes/

Request

Route

POST /v2/routes

Body

Name Description Default Valid Values Example Values
guid The guid of the route.
domain_guid The guid of the associated domain
  • guid-a0fc6e46-5374-42a4-a9bd-00f3b21725a8
space_guid The guid of the associated space
  • guid-c1e33016-47b8-4a4c-b42b-9a6e6bdec8a9
host The host portion of the route
port The port of the route. Supported for domains of TCP router groups only.
  • 1024-65535
  • 50000
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": "55328a99-1f93-4602-b488-6321539080a0",
  "space_guid": "60829643-9634-4ab2-931d-8c423a2bd9b6",
  "path": "/apps/v1/path",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3OSIsImVtYWlsIjoiZW1haWwtMjgxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDUzNjIzMTl9.QOV05izfJxxEbUJsSkjwDbppeC-MOrBL7cyqVlyngXE
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "55328a99-1f93-4602-b488-6321539080a0",
  "space_guid": "60829643-9634-4ab2-931d-8c423a2bd9b6",
  "path": "/apps/v1/path",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3OSIsImVtYWlsIjoiZW1haWwtMjgxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDUzNjIzMTl9.QOV05izfJxxEbUJsSkjwDbppeC-MOrBL7cyqVlyngXE" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "3ef3977a-6d17-465f-8fb3-bffaad84ff56",
    "url": "/v2/routes/3ef3977a-6d17-465f-8fb3-bffaad84ff56",
    "created_at": "2015-10-13T17:31:59Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "55328a99-1f93-4602-b488-6321539080a0",
    "space_guid": "60829643-9634-4ab2-931d-8c423a2bd9b6",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/55328a99-1f93-4602-b488-6321539080a0",
    "space_url": "/v2/spaces/60829643-9634-4ab2-931d-8c423a2bd9b6",
    "apps_url": "/v2/routes/3ef3977a-6d17-465f-8fb3-bffaad84ff56/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/3ef3977a-6d17-465f-8fb3-bffaad84ff56
X-VCAP-Request-ID: fd3186a0-6998-4573-bca2-470696f3ec3c
Content-Length: 646
X-Content-Type-Options: nosniff