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-6fda31a1-8b02-41dd-95ff-9e77178390b2
space_guid The guid of the associated space
  • guid-2b8a1e2b-a680-4e5c-a665-d553fea892b0
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": "e837e660-04d3-4a7a-896e-8f20c1447f75",
  "space_guid": "3cfb59ee-c39f-4f6b-a4a9-a6879fc3a919",
  "port": 10000
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "e837e660-04d3-4a7a-896e-8f20c1447f75",
  "space_guid": "3cfb59ee-c39f-4f6b-a4a9-a6879fc3a919",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE2NyIsImVtYWlsIjoiZW1haWwtMTM1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjE5NTg0MDF9.j7UZa4tmpgxRF2RwffccVSo1O_N_MYxjsRez1FUYrBU" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "6e17aaec-7038-44d5-9f59-f92377bd65ac",
    "url": "/v2/routes/6e17aaec-7038-44d5-9f59-f92377bd65ac",
    "created_at": "2016-04-22T19:33:21Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "e837e660-04d3-4a7a-896e-8f20c1447f75",
    "space_guid": "3cfb59ee-c39f-4f6b-a4a9-a6879fc3a919",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/e837e660-04d3-4a7a-896e-8f20c1447f75",
    "space_url": "/v2/spaces/3cfb59ee-c39f-4f6b-a4a9-a6879fc3a919",
    "apps_url": "/v2/routes/6e17aaec-7038-44d5-9f59-f92377bd65ac/apps",
    "route_mappings_url": "/v2/routes/6e17aaec-7038-44d5-9f59-f92377bd65ac/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/6e17aaec-7038-44d5-9f59-f92377bd65ac
X-VCAP-Request-ID: 3a9f815b-7134-4072-9538-984770830cde
Content-Length: 725
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.route.create

Attribute Name Value
id 30
guid c0439406-591a-4bb8-9b84-96d8d56f80bd
created_at 2016-04-22 19:33:21 UTC
updated_at
timestamp 2016-04-22 19:33:21 UTC
type audit.route.create
actor uaa-id-167
actor_type user
actee 6e17aaec-7038-44d5-9f59-f92377bd65ac
actee_type route
metadata
{
  "request": {
    "domain_guid": "e837e660-04d3-4a7a-896e-8f20c1447f75",
    "space_guid": "3cfb59ee-c39f-4f6b-a4a9-a6879fc3a919",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid ffae55e6-472b-4ea1-9ad4-bc3cae60423b
space_guid 3cfb59ee-c39f-4f6b-a4a9-a6879fc3a919
actor_name email-135@somedomain.com
actee_name