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-fd5e8c4d-0986-4793-a9f3-8e0f790c3c2f
space_guid The guid of the associated space
  • guid-bc782a8d-1e46-499c-a244-745d56000329
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": "f66e58e2-2d3d-4dce-8063-f5eb5e66f2e2",
  "space_guid": "ac5d3eee-8654-4689-b9e8-b97c54aea6b6",
  "port": 10000
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEzMiIsImVtYWlsIjoiZW1haWwtOTNAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1ODU5OTQzMX0.lqm77JPkNbPBD40MEXIOaYz43rKFg0JvFcxNCI-RLpk
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "f66e58e2-2d3d-4dce-8063-f5eb5e66f2e2",
  "space_guid": "ac5d3eee-8654-4689-b9e8-b97c54aea6b6",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEzMiIsImVtYWlsIjoiZW1haWwtOTNAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ1ODU5OTQzMX0.lqm77JPkNbPBD40MEXIOaYz43rKFg0JvFcxNCI-RLpk" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "359bc66b-39c4-426a-868d-11fb85cb8609",
    "url": "/v2/routes/359bc66b-39c4-426a-868d-11fb85cb8609",
    "created_at": "2016-03-14T22:30:31Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "f66e58e2-2d3d-4dce-8063-f5eb5e66f2e2",
    "space_guid": "ac5d3eee-8654-4689-b9e8-b97c54aea6b6",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/f66e58e2-2d3d-4dce-8063-f5eb5e66f2e2",
    "space_url": "/v2/spaces/ac5d3eee-8654-4689-b9e8-b97c54aea6b6",
    "apps_url": "/v2/routes/359bc66b-39c4-426a-868d-11fb85cb8609/apps",
    "route_mappings_url": "/v2/routes/359bc66b-39c4-426a-868d-11fb85cb8609/route_mappings"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/359bc66b-39c4-426a-868d-11fb85cb8609
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 173
guid 0d51fcbe-2531-44b7-b0ce-8b144e475584
created_at 2016-03-14 22:30:31 UTC
updated_at
timestamp 2016-03-14 22:30:31 UTC
type audit.route.create
actor uaa-id-132
actor_type user
actee 359bc66b-39c4-426a-868d-11fb85cb8609
actee_type route
metadata
{
  "request": {
    "domain_guid": "f66e58e2-2d3d-4dce-8063-f5eb5e66f2e2",
    "space_guid": "ac5d3eee-8654-4689-b9e8-b97c54aea6b6",
    "port": 10000,
    "host": ""
  }
}
space_id
organization_guid 5326581f-4390-40c1-b55c-d01267c7f721
space_guid ac5d3eee-8654-4689-b9e8-b97c54aea6b6
actor_name email-93@somedomain.com
actee_name