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
guid The guid of the route.
domain_guid The guid of the associated domain
  • guid-c4d3c470-1502-4e16-ac24-c7e2a16ed6e3
space_guid The guid of the associated space
  • guid-0fd61d06-a08b-41db-8295-28a4f0ee6f8c
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": "af83ee13-de33-451f-9cdb-8e06d4478894",
  "space_guid": "41d76195-e70d-49df-8f72-fe18292b9502",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTk0IiwiZW1haWwiOiJlbWFpbC01OUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ4MDM4OTQ2fQ.cav6C9kqr5u2AMzQKCo988zNNtGBAmuPR1kO1wU-gWo
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "af83ee13-de33-451f-9cdb-8e06d4478894",
  "space_guid": "41d76195-e70d-49df-8f72-fe18292b9502",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTk0IiwiZW1haWwiOiJlbWFpbC01OUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ4MDM4OTQ2fQ.cav6C9kqr5u2AMzQKCo988zNNtGBAmuPR1kO1wU-gWo" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "858e14e7-ccb5-42bd-a1c3-716631a75139",
    "url": "/v2/routes/858e14e7-ccb5-42bd-a1c3-716631a75139",
    "created_at": "2015-11-13T17:02:26Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "af83ee13-de33-451f-9cdb-8e06d4478894",
    "space_guid": "41d76195-e70d-49df-8f72-fe18292b9502",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/af83ee13-de33-451f-9cdb-8e06d4478894",
    "space_url": "/v2/spaces/41d76195-e70d-49df-8f72-fe18292b9502",
    "apps_url": "/v2/routes/858e14e7-ccb5-42bd-a1c3-716631a75139/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/858e14e7-ccb5-42bd-a1c3-716631a75139
X-VCAP-Request-ID: 
Content-Length: 633
X-Content-Type-Options: nosniff