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-39e53050-c82d-4a41-ad4c-7bca7b48710c
space_guid The guid of the associated space
  • guid-5896f70f-18d4-4579-a3d0-6d09f60119b8
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": "01382eba-6ff8-409d-a8d8-de319a27ce48",
  "space_guid": "60ea70fc-f89a-4dd3-978e-fea56523f5a2",
  "path": "/apps/v1/path"
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "01382eba-6ff8-409d-a8d8-de319a27ce48",
  "space_guid": "60ea70fc-f89a-4dd3-978e-fea56523f5a2",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEyNiIsImVtYWlsIjoiZW1haWwtODFAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQzODY0MTc5Mn0.Ul9lB9pl5bsAmsWn0Nqmv38PLo1LfIWPoBwt63m7NSs" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "a4e131b2-4b37-449a-a07c-07169038ef47",
    "url": "/v2/routes/a4e131b2-4b37-449a-a07c-07169038ef47",
    "created_at": "2015-07-27T22:43:12Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "01382eba-6ff8-409d-a8d8-de319a27ce48",
    "space_guid": "60ea70fc-f89a-4dd3-978e-fea56523f5a2",
    "domain_url": "/v2/domains/01382eba-6ff8-409d-a8d8-de319a27ce48",
    "space_url": "/v2/spaces/60ea70fc-f89a-4dd3-978e-fea56523f5a2",
    "apps_url": "/v2/routes/a4e131b2-4b37-449a-a07c-07169038ef47/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/a4e131b2-4b37-449a-a07c-07169038ef47
X-VCAP-Request-ID: d8227f9a-82de-459b-9bed-f2f7118b5d24
Content-Length: 592
X-Content-Type-Options: nosniff