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-0cacdb9a-0811-4bb3-92d1-fc35e53aa478
space_guid The guid of the associated space
  • guid-8f691cad-dbfb-42b7-9ca2-3967f8f51ac0
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": "d282bf0c-3c2e-45ed-896e-282e00eca981",
  "space_guid": "5f307239-4c71-4530-b4ca-4dd9c941b4af",
  "path": "/apps/v1/path"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI3NiIsImVtYWlsIjoiZW1haWwtMTkzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzM5ODExMTN9.P1cK5Je8vAzpphrM8Aon8EG-oMt7Z4BPcx5gPOVpzj0
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "d282bf0c-3c2e-45ed-896e-282e00eca981",
  "space_guid": "5f307239-4c71-4530-b4ca-4dd9c941b4af",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI3NiIsImVtYWlsIjoiZW1haWwtMTkzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzM5ODExMTN9.P1cK5Je8vAzpphrM8Aon8EG-oMt7Z4BPcx5gPOVpzj0" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "c9edb661-331b-44a0-adfe-8bd2cf8f8829",
    "url": "/v2/routes/c9edb661-331b-44a0-adfe-8bd2cf8f8829",
    "created_at": "2015-06-04T00:05:13Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "d282bf0c-3c2e-45ed-896e-282e00eca981",
    "space_guid": "5f307239-4c71-4530-b4ca-4dd9c941b4af",
    "domain_url": "/v2/domains/d282bf0c-3c2e-45ed-896e-282e00eca981",
    "space_url": "/v2/spaces/5f307239-4c71-4530-b4ca-4dd9c941b4af",
    "apps_url": "/v2/routes/c9edb661-331b-44a0-adfe-8bd2cf8f8829/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/c9edb661-331b-44a0-adfe-8bd2cf8f8829
X-VCAP-Request-ID: d49c2492-dfb2-4a8f-bb2c-96cfbdc25126
Content-Length: 592
X-Content-Type-Options: nosniff