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-b25b9aa2-adad-48a4-93ea-592597821105
space_guid The guid of the associated space
  • guid-ef78dd75-fd53-4723-a2b4-7240b422d795
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": "a1933f4c-c31b-4d9c-8614-139c5ed98ae9",
  "space_guid": "b20b3800-5da9-4e4d-96ae-eed3fa0104bc",
  "path": "/apps/v1/path"
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "a1933f4c-c31b-4d9c-8614-139c5ed98ae9",
  "space_guid": "b20b3800-5da9-4e4d-96ae-eed3fa0104bc",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQwMCIsImVtYWlsIjoiZW1haWwtMjY4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDQ3ODI5NDN9.kNHij5x9w6jj0jtgLCk3d_nLUeOvfrK1_LWVghSHqgs" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "e79b4922-a93b-4c27-b860-8f2052b8229d",
    "url": "/v2/routes/e79b4922-a93b-4c27-b860-8f2052b8229d",
    "created_at": "2015-10-07T00:35:43Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "a1933f4c-c31b-4d9c-8614-139c5ed98ae9",
    "space_guid": "b20b3800-5da9-4e4d-96ae-eed3fa0104bc",
    "service_instance_guid": null,
    "domain_url": "/v2/domains/a1933f4c-c31b-4d9c-8614-139c5ed98ae9",
    "space_url": "/v2/spaces/b20b3800-5da9-4e4d-96ae-eed3fa0104bc",
    "apps_url": "/v2/routes/e79b4922-a93b-4c27-b860-8f2052b8229d/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/e79b4922-a93b-4c27-b860-8f2052b8229d
X-VCAP-Request-ID: 4fcf9e2a-c621-4291-a0a1-60433063d0d4
Content-Length: 627
X-Content-Type-Options: nosniff