Home
Version 3
Routes API

Routes API

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.
  • true
  • false

Body

Name Description Default Valid Values Example Values
domain_guid The guid of the associated domain
  • guid-e37ba994-81a2-4ad6-a052-d651c2cb8a3c
space_guid The guid of the associated space
  • guid-c324f726-2895-4824-9ac7-053eff29808e
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": "42761e1b-ff87-4933-8b8f-5262d7a510c2",
  "space_guid": "c1217806-36f3-442f-9996-3e201b91adf7",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4MCIsImVtYWlsIjoiZW1haWwtMTg2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTE0MTM2ODl9.TVJ7fFHNNNmi_NDV1Lm3ieSrSXlOc0Ou01KKzmiuRyE
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "42761e1b-ff87-4933-8b8f-5262d7a510c2",
  "space_guid": "c1217806-36f3-442f-9996-3e201b91adf7",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4MCIsImVtYWlsIjoiZW1haWwtMTg2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTE0MTM2ODl9.TVJ7fFHNNNmi_NDV1Lm3ieSrSXlOc0Ou01KKzmiuRyE" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "bbedef6d-6943-4856-9191-7a1b3e0a1b0b",
    "url": "/v2/routes/bbedef6d-6943-4856-9191-7a1b3e0a1b0b",
    "created_at": "2015-12-22T18:28:09Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "42761e1b-ff87-4933-8b8f-5262d7a510c2",
    "space_guid": "c1217806-36f3-442f-9996-3e201b91adf7",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/42761e1b-ff87-4933-8b8f-5262d7a510c2",
    "space_url": "/v2/spaces/c1217806-36f3-442f-9996-3e201b91adf7",
    "apps_url": "/v2/routes/bbedef6d-6943-4856-9191-7a1b3e0a1b0b/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/bbedef6d-6943-4856-9191-7a1b3e0a1b0b
X-VCAP-Request-ID: 
Content-Length: 633
X-Content-Type-Options: nosniff