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-f291361f-8a1e-49ad-b26c-8af02e75e058
space_guid The guid of the associated space
  • guid-3d35ced8-dcbe-4f23-89c2-43c42883597e
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": "7bc843a6-924a-4cb9-b8d5-79ba7ba64f0b",
  "space_guid": "a00728c9-1997-4f9a-bcd8-d92b4860d409",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE2NSIsImVtYWlsIjoiZW1haWwtMTMyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTQ0NTE2MTd9.Vt_kZ4SF-giPANtTu2i3B-6lRSd0vtYgIrO-3_kh-EI
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "7bc843a6-924a-4cb9-b8d5-79ba7ba64f0b",
  "space_guid": "a00728c9-1997-4f9a-bcd8-d92b4860d409",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE2NSIsImVtYWlsIjoiZW1haWwtMTMyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTQ0NTE2MTd9.Vt_kZ4SF-giPANtTu2i3B-6lRSd0vtYgIrO-3_kh-EI" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "32992250-2cc8-4a23-985c-4161d1db8abc",
    "url": "/v2/routes/32992250-2cc8-4a23-985c-4161d1db8abc",
    "created_at": "2016-01-26T22:20:17Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "7bc843a6-924a-4cb9-b8d5-79ba7ba64f0b",
    "space_guid": "a00728c9-1997-4f9a-bcd8-d92b4860d409",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/7bc843a6-924a-4cb9-b8d5-79ba7ba64f0b",
    "space_url": "/v2/spaces/a00728c9-1997-4f9a-bcd8-d92b4860d409",
    "apps_url": "/v2/routes/32992250-2cc8-4a23-985c-4161d1db8abc/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/32992250-2cc8-4a23-985c-4161d1db8abc
X-VCAP-Request-ID: 
Content-Length: 633
X-Content-Type-Options: nosniff