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-aa92b73d-abb6-4328-a7be-788798458c79
space_guid The guid of the associated space
  • guid-50ca0832-a1a2-4d21-8b70-c67297c30ff4
host The host portion of the route. Required for shared-domains.
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 forward slash "/" 3) Paths must not contain a "?"
  • /apps/v1/path
  • /apps/v2/path
{
  "domain_guid": "c94d8b7e-081e-4293-8f24-964a2fe2b16c",
  "space_guid": "759cb2e0-239b-4202-ab83-1e6fd66becee",
  "port": 10000
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "c94d8b7e-081e-4293-8f24-964a2fe2b16c",
  "space_guid": "759cb2e0-239b-4202-ab83-1e6fd66becee",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI4NSIsImVtYWlsIjoiZW1haWwtMTkyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg4NTU2Nzl9._UA5fjx7ig9PY5XRPPALM7PMJBU7g_w3QyTFlKov0W8" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "ad307f5b-efec-4034-8cf1-1f86515ee093",
    "url": "/v2/routes/ad307f5b-efec-4034-8cf1-1f86515ee093",
    "created_at": "2016-03-17T21:41:19Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "c94d8b7e-081e-4293-8f24-964a2fe2b16c",
    "space_guid": "759cb2e0-239b-4202-ab83-1e6fd66becee",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/c94d8b7e-081e-4293-8f24-964a2fe2b16c",
    "space_url": "/v2/spaces/759cb2e0-239b-4202-ab83-1e6fd66becee",
    "apps_url": "/v2/routes/ad307f5b-efec-4034-8cf1-1f86515ee093/apps",
    "route_mappings_url": "/v2/routes/ad307f5b-efec-4034-8cf1-1f86515ee093/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/ad307f5b-efec-4034-8cf1-1f86515ee093
X-VCAP-Request-ID: 
Content-Length: 725
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.route.create

Attribute Name Value
id 47
guid 6ed72d83-632d-4df3-8c46-fb25099e26a4
created_at 2016-03-17 21:41:19 UTC
updated_at
timestamp 2016-03-17 21:41:19 UTC
type audit.route.create
actor uaa-id-285
actor_type user
actee ad307f5b-efec-4034-8cf1-1f86515ee093
actee_type route
metadata
{
  "request": {
    "domain_guid": "c94d8b7e-081e-4293-8f24-964a2fe2b16c",
    "space_guid": "759cb2e0-239b-4202-ab83-1e6fd66becee",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid 99a87018-9ec3-4ad1-9229-09d531352a8c
space_guid 759cb2e0-239b-4202-ab83-1e6fd66becee
actor_name email-192@somedomain.com
actee_name