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-163d65c1-1656-4ed3-98ce-720b97627a64
space_guid The guid of the associated space
  • guid-c65c19bc-f616-43aa-9521-3e3673c7afe4
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": "d92fc697-9da0-4473-bdc1-39c7bb2c45c0",
  "space_guid": "e998ac58-058a-4c77-98b9-def593c1a156",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxNiIsImVtYWlsIjoiZW1haWwtMjc4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjM2MTg3Mjd9.qzbc2g484L-TdKbvrFygpV0n5mHFevX4_uaAzkUt6nE
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "d92fc697-9da0-4473-bdc1-39c7bb2c45c0",
  "space_guid": "e998ac58-058a-4c77-98b9-def593c1a156",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxNiIsImVtYWlsIjoiZW1haWwtMjc4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjM2MTg3Mjd9.qzbc2g484L-TdKbvrFygpV0n5mHFevX4_uaAzkUt6nE" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "fea8172d-84bc-4bb5-b6e5-0ff498b96910",
    "url": "/v2/routes/fea8172d-84bc-4bb5-b6e5-0ff498b96910",
    "created_at": "2016-05-12T00:45:27Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "d92fc697-9da0-4473-bdc1-39c7bb2c45c0",
    "space_guid": "e998ac58-058a-4c77-98b9-def593c1a156",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/d92fc697-9da0-4473-bdc1-39c7bb2c45c0",
    "space_url": "/v2/spaces/e998ac58-058a-4c77-98b9-def593c1a156",
    "apps_url": "/v2/routes/fea8172d-84bc-4bb5-b6e5-0ff498b96910/apps",
    "route_mappings_url": "/v2/routes/fea8172d-84bc-4bb5-b6e5-0ff498b96910/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/fea8172d-84bc-4bb5-b6e5-0ff498b96910
X-VCAP-Request-ID: bf4f8e3b-019b-4448-8e95-d59b3aae654a
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 c3a63bf1-304b-449e-80bd-313663629e76
created_at 2016-05-12 00:45:27 UTC
updated_at
timestamp 2016-05-12 00:45:27 UTC
type audit.route.create
actor uaa-id-416
actor_type user
actee fea8172d-84bc-4bb5-b6e5-0ff498b96910
actee_type route
metadata
{
  "request": {
    "domain_guid": "d92fc697-9da0-4473-bdc1-39c7bb2c45c0",
    "space_guid": "e998ac58-058a-4c77-98b9-def593c1a156",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid 3b428e05-b64f-458f-8cb2-b3f9e5d2bc64
space_guid e998ac58-058a-4c77-98b9-def593c1a156
actor_name email-278@somedomain.com
actee_name