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-4d306566-6012-4516-aedf-1ee6a870f23b
space_guid The guid of the associated space
  • guid-0bee9f02-58c4-4117-8c84-1fea0edb2feb
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": "4d9e6314-58ca-4f09-a736-d8bcc903b95e",
  "space_guid": "2f093daf-c030-4b57-99c2-9b8858b200e4",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3MiIsImVtYWlsIjoiZW1haWwtMjc0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDk1MzE1MzV9.UHgGBnfEKirbe1z_Bf2cw-YJQg2j4mPYgLGIf31NNdg
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "4d9e6314-58ca-4f09-a736-d8bcc903b95e",
  "space_guid": "2f093daf-c030-4b57-99c2-9b8858b200e4",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3MiIsImVtYWlsIjoiZW1haWwtMjc0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDk1MzE1MzV9.UHgGBnfEKirbe1z_Bf2cw-YJQg2j4mPYgLGIf31NNdg" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "e689dab1-c4e7-4499-b708-7c649949e86d",
    "url": "/v2/routes/e689dab1-c4e7-4499-b708-7c649949e86d",
    "created_at": "2015-11-30T23:38:55Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "4d9e6314-58ca-4f09-a736-d8bcc903b95e",
    "space_guid": "2f093daf-c030-4b57-99c2-9b8858b200e4",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/4d9e6314-58ca-4f09-a736-d8bcc903b95e",
    "space_url": "/v2/spaces/2f093daf-c030-4b57-99c2-9b8858b200e4",
    "apps_url": "/v2/routes/e689dab1-c4e7-4499-b708-7c649949e86d/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/e689dab1-c4e7-4499-b708-7c649949e86d
X-VCAP-Request-ID: 
Content-Length: 633
X-Content-Type-Options: nosniff