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-12c79f6c-ad5d-47d2-a176-c5b25cbffd82
space_guid The guid of the associated space
  • guid-d16757ec-8e19-45b4-b81c-7ce00771fa99
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": "cea335ae-1896-4350-83b4-b7020c605762",
  "space_guid": "754919fd-a2d6-423c-998b-25b6f1cc0d20",
  "path": "/apps/v1/path"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxMSIsImVtYWlsIjoiZW1haWwtMzAzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzY4Mjk4MDF9.x_gkhsVG-RUAk_5uV-KwSrA8cwijngE_U3k4ULuuRFM
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "cea335ae-1896-4350-83b4-b7020c605762",
  "space_guid": "754919fd-a2d6-423c-998b-25b6f1cc0d20",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxMSIsImVtYWlsIjoiZW1haWwtMzAzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzY4Mjk4MDF9.x_gkhsVG-RUAk_5uV-KwSrA8cwijngE_U3k4ULuuRFM" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "a18ca95c-db9e-4153-bde3-60fe4f6cf08b",
    "url": "/v2/routes/a18ca95c-db9e-4153-bde3-60fe4f6cf08b",
    "created_at": "2015-07-06T23:23:21Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "cea335ae-1896-4350-83b4-b7020c605762",
    "space_guid": "754919fd-a2d6-423c-998b-25b6f1cc0d20",
    "domain_url": "/v2/domains/cea335ae-1896-4350-83b4-b7020c605762",
    "space_url": "/v2/spaces/754919fd-a2d6-423c-998b-25b6f1cc0d20",
    "apps_url": "/v2/routes/a18ca95c-db9e-4153-bde3-60fe4f6cf08b/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/a18ca95c-db9e-4153-bde3-60fe4f6cf08b
X-VCAP-Request-ID: d516b69c-e1e4-40c3-ab63-58a0e8d401bd
Content-Length: 592
X-Content-Type-Options: nosniff