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-7ba8d9f9-acd0-4349-b8ed-d94105ce9249
space_guid The guid of the associated space
  • guid-d29d5385-9a08-48e4-a385-9db0ff882f05
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": "b970262e-90d0-46d5-af99-2a15810c0755",
  "space_guid": "d7262fea-e1ac-4e9b-8045-2c5d70a4d929",
  "port": 10000
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "b970262e-90d0-46d5-af99-2a15810c0755",
  "space_guid": "d7262fea-e1ac-4e9b-8045-2c5d70a4d929",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM2MCIsImVtYWlsIjoiZW1haWwtMjYyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjEzNzQ2NDN9.c_FXn1zKt3ISPaRA5GrSaRikthLC0BdsR3PPEWgRaH8" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "48cbb596-f9e5-4d56-bd13-1885b556dbd1",
    "url": "/v2/routes/48cbb596-f9e5-4d56-bd13-1885b556dbd1",
    "created_at": "2016-04-16T01:24:03Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "b970262e-90d0-46d5-af99-2a15810c0755",
    "space_guid": "d7262fea-e1ac-4e9b-8045-2c5d70a4d929",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/b970262e-90d0-46d5-af99-2a15810c0755",
    "space_url": "/v2/spaces/d7262fea-e1ac-4e9b-8045-2c5d70a4d929",
    "apps_url": "/v2/routes/48cbb596-f9e5-4d56-bd13-1885b556dbd1/apps",
    "route_mappings_url": "/v2/routes/48cbb596-f9e5-4d56-bd13-1885b556dbd1/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/48cbb596-f9e5-4d56-bd13-1885b556dbd1
X-VCAP-Request-ID: b0464b34-abdb-407e-8c6c-41e77a13d6a6
Content-Length: 725
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.route.create

Attribute Name Value
id 59
guid dea5c4d8-2258-4742-8f93-49ae38d145cf
created_at 2016-04-16 01:24:03 UTC
updated_at
timestamp 2016-04-16 01:24:03 UTC
type audit.route.create
actor uaa-id-360
actor_type user
actee 48cbb596-f9e5-4d56-bd13-1885b556dbd1
actee_type route
metadata
{
  "request": {
    "domain_guid": "b970262e-90d0-46d5-af99-2a15810c0755",
    "space_guid": "d7262fea-e1ac-4e9b-8045-2c5d70a4d929",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid b593a2da-62e1-4d36-a807-e4bdaeeb02cb
space_guid d7262fea-e1ac-4e9b-8045-2c5d70a4d929
actor_name email-262@somedomain.com
actee_name