Home
Version 3
Routes API

Routes API

Creating a Route

POST /v2/routes/

Request

Route

POST /v2/routes

Body

Name Description Default Valid Values Example Values
guid The guid of the route.
domain_guid The guid of the associated domain
  • guid-1014dc2a-d52c-42e7-91d1-2ffb965dc798
space_guid The guid of the associated space
  • guid-b17a9262-51a8-46d6-a98e-84ab31711b3a
host The host portion of the route
path The path for a route as raw text. 1) Paths must be between 2 and 128 characters 2) Paths must start with a / 3) Paths must not contain a "?"
  • /apps/v1/path
  • /apps/v2/path
{
  "domain_guid": "9946c3fb-35a3-4994-9625-1c939b3c07d9",
  "space_guid": "ec8d074f-614b-4b17-9224-74d6b97ecad2",
  "path": "/apps/v1/path"
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "9946c3fb-35a3-4994-9625-1c939b3c07d9",
  "space_guid": "ec8d074f-614b-4b17-9224-74d6b97ecad2",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxNSIsImVtYWlsIjoiZW1haWwtMzA1QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0Mzk0MjYyMTd9.tv8BJuT1oVbM9kxAdXZ549dYKGQUy3mdpxa06UedBh4" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "9f576c52-07a7-4887-8a97-4fb5a4b996d1",
    "url": "/v2/routes/9f576c52-07a7-4887-8a97-4fb5a4b996d1",
    "created_at": "2015-08-06T00:36:57Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "9946c3fb-35a3-4994-9625-1c939b3c07d9",
    "space_guid": "ec8d074f-614b-4b17-9224-74d6b97ecad2",
    "domain_url": "/v2/domains/9946c3fb-35a3-4994-9625-1c939b3c07d9",
    "space_url": "/v2/spaces/ec8d074f-614b-4b17-9224-74d6b97ecad2",
    "apps_url": "/v2/routes/9f576c52-07a7-4887-8a97-4fb5a4b996d1/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/9f576c52-07a7-4887-8a97-4fb5a4b996d1
X-VCAP-Request-ID: ab5bbd89-ce0e-41dc-8df4-77ef52482fb3
Content-Length: 592
X-Content-Type-Options: nosniff