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-355b070e-5639-43bc-af20-2f3e2e1baff9
space_guid The guid of the associated space
  • guid-9e408e2b-f003-48c1-8119-3107d911f09a
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": "25e7319e-d1cc-409d-b6a1-3f48a0f7c6fb",
  "space_guid": "c38e9fa4-5c6b-4600-bc68-4b4c5ee62e87",
  "port": 10000
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "25e7319e-d1cc-409d-b6a1-3f48a0f7c6fb",
  "space_guid": "c38e9fa4-5c6b-4600-bc68-4b4c5ee62e87",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQyNSIsImVtYWlsIjoiZW1haWwtMjk0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjA1MDY2NjF9.GCpNBY0uByOUEyp8PvOIaeNQ10uwUCizxpIMga8zBzE" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "c79b1b25-20da-4a5d-a46b-21519c00393d",
    "url": "/v2/routes/c79b1b25-20da-4a5d-a46b-21519c00393d",
    "created_at": "2016-04-06T00:17:41Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "25e7319e-d1cc-409d-b6a1-3f48a0f7c6fb",
    "space_guid": "c38e9fa4-5c6b-4600-bc68-4b4c5ee62e87",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/25e7319e-d1cc-409d-b6a1-3f48a0f7c6fb",
    "space_url": "/v2/spaces/c38e9fa4-5c6b-4600-bc68-4b4c5ee62e87",
    "apps_url": "/v2/routes/c79b1b25-20da-4a5d-a46b-21519c00393d/apps",
    "route_mappings_url": "/v2/routes/c79b1b25-20da-4a5d-a46b-21519c00393d/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/c79b1b25-20da-4a5d-a46b-21519c00393d
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 215
guid 4422830d-dbbb-49c9-85b4-69259adde1d6
created_at 2016-04-06 00:17:41 UTC
updated_at
timestamp 2016-04-06 00:17:41 UTC
type audit.route.create
actor uaa-id-425
actor_type user
actee c79b1b25-20da-4a5d-a46b-21519c00393d
actee_type route
metadata
{
  "request": {
    "domain_guid": "25e7319e-d1cc-409d-b6a1-3f48a0f7c6fb",
    "space_guid": "c38e9fa4-5c6b-4600-bc68-4b4c5ee62e87",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid 5a5f5dc4-90d0-4513-9d6a-b6c7650744a1
space_guid c38e9fa4-5c6b-4600-bc68-4b4c5ee62e87
actor_name email-294@somedomain.com
actee_name