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-c09f1e04-18af-4ea8-8bf0-acbac440b9b0
space_guid The guid of the associated space
  • guid-a6f5cc52-6e59-4139-a3e7-b4d0e9334003
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": "8b61b9c9-8f78-4400-9f7f-a60af674d956",
  "space_guid": "9d60dc71-7435-4daa-95df-0377b6028898",
  "path": "/apps/v1/path"
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "8b61b9c9-8f78-4400-9f7f-a60af674d956",
  "space_guid": "9d60dc71-7435-4daa-95df-0377b6028898",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0OCIsImVtYWlsIjoiZW1haWwtMTgxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDI2MDE1Mzl9.Ipg86NiesV_7zFfxDyPadRYDdWp_aKH1haFx9D2knkU" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "647cf41b-1e84-4e28-b74a-3e3019770aa9",
    "url": "/v2/routes/647cf41b-1e84-4e28-b74a-3e3019770aa9",
    "created_at": "2015-09-11T18:38:59Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "8b61b9c9-8f78-4400-9f7f-a60af674d956",
    "space_guid": "9d60dc71-7435-4daa-95df-0377b6028898",
    "service_instance_guid": null,
    "domain_url": "/v2/domains/8b61b9c9-8f78-4400-9f7f-a60af674d956",
    "space_url": "/v2/spaces/9d60dc71-7435-4daa-95df-0377b6028898",
    "apps_url": "/v2/routes/647cf41b-1e84-4e28-b74a-3e3019770aa9/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/647cf41b-1e84-4e28-b74a-3e3019770aa9
X-VCAP-Request-ID: ed64eda6-a605-4c8d-9d84-1d211e23863f
Content-Length: 627
X-Content-Type-Options: nosniff