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-f3ee2d74-af5b-440a-a91c-acf253eb1d02
space_guid The guid of the associated space
  • guid-0f3594a3-36cc-4e73-ba22-89131d6163c4
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 "?" Note: not supported for internal routes.
  • /apps/v1/path
  • /apps/v2/path
{
  "domain_guid": "83c53281-a904-46c7-8eeb-8246d9955f0d",
  "space_guid": "299cedc7-ca5d-4384-b78f-52bb8e6e1c04",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEzNSIsImVtYWlsIjoiZW1haWwtOTBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2NjAwODg4OH0.RtMC1co7U_m2aeszr4I-Lz4N5KNvmxn5lukOFcJe9XA
Host: example.org
Content-Type: application/json
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "83c53281-a904-46c7-8eeb-8246d9955f0d",
  "space_guid": "299cedc7-ca5d-4384-b78f-52bb8e6e1c04",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEzNSIsImVtYWlsIjoiZW1haWwtOTBAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2NjAwODg4OH0.RtMC1co7U_m2aeszr4I-Lz4N5KNvmxn5lukOFcJe9XA" \
	-H "Host: example.org" \
	-H "Content-Type: application/json" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "32c16ec5-07c7-4e36-980b-3195af5c9abf",
    "url": "/v2/routes/32c16ec5-07c7-4e36-980b-3195af5c9abf",
    "created_at": "2016-06-08T16:41:28Z",
    "updated_at": "2016-06-08T16:41:26Z"
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "83c53281-a904-46c7-8eeb-8246d9955f0d",
    "space_guid": "299cedc7-ca5d-4384-b78f-52bb8e6e1c04",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/shared_domains/83c53281-a904-46c7-8eeb-8246d9955f0d",
    "space_url": "/v2/spaces/299cedc7-ca5d-4384-b78f-52bb8e6e1c04",
    "apps_url": "/v2/routes/32c16ec5-07c7-4e36-980b-3195af5c9abf/apps",
    "route_mappings_url": "/v2/routes/32c16ec5-07c7-4e36-980b-3195af5c9abf/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/32c16ec5-07c7-4e36-980b-3195af5c9abf
X-VCAP-Request-ID: 4aabf425-9d4e-4e5d-93d3-83f949bcbe79
Content-Length: 732
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.route.create

Attribute Name Value
id 192
guid b90f0c36-7012-4bc5-a496-193d70ca39e5
created_at 2016-06-08 16:41:28 UTC
updated_at
timestamp 2016-06-08 16:41:28 UTC
type audit.route.create
actor uaa-id-135
actor_type user
actee 32c16ec5-07c7-4e36-980b-3195af5c9abf
actee_type route
metadata
{
  "request": {
    "domain_guid": "83c53281-a904-46c7-8eeb-8246d9955f0d",
    "space_guid": "299cedc7-ca5d-4384-b78f-52bb8e6e1c04",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid 3996f758-db13-4923-b3ac-a45f6ac11350
space_guid 299cedc7-ca5d-4384-b78f-52bb8e6e1c04
actor_name [email protected]
actee_name