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-557c1974-98f3-49eb-8c40-45cfb56b2a72
space_guid The guid of the associated space
  • guid-2ceb8ed3-3b71-4fe4-8ea3-9dcd3350ecb5
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": "83fb0f95-3119-4e9d-b070-b3d9850167dd",
  "space_guid": "16a6cdd3-eef6-4dbf-90c1-351dfd2d85e9",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIzMiIsImVtYWlsIjoiZW1haWwtMTY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTM4MzcyNzJ9.DINy-LJJpL6cJmgjzQrbtK97SyjYjgtagRZDVktcTOs
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "83fb0f95-3119-4e9d-b070-b3d9850167dd",
  "space_guid": "16a6cdd3-eef6-4dbf-90c1-351dfd2d85e9",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIzMiIsImVtYWlsIjoiZW1haWwtMTY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTM4MzcyNzJ9.DINy-LJJpL6cJmgjzQrbtK97SyjYjgtagRZDVktcTOs" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "00442f87-9070-40c4-bef5-f308ff8f39dc",
    "url": "/v2/routes/00442f87-9070-40c4-bef5-f308ff8f39dc",
    "created_at": "2016-01-19T19:41:12Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "83fb0f95-3119-4e9d-b070-b3d9850167dd",
    "space_guid": "16a6cdd3-eef6-4dbf-90c1-351dfd2d85e9",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/83fb0f95-3119-4e9d-b070-b3d9850167dd",
    "space_url": "/v2/spaces/16a6cdd3-eef6-4dbf-90c1-351dfd2d85e9",
    "apps_url": "/v2/routes/00442f87-9070-40c4-bef5-f308ff8f39dc/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/00442f87-9070-40c4-bef5-f308ff8f39dc
X-VCAP-Request-ID: 
Content-Length: 633
X-Content-Type-Options: nosniff