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-0e28b78d-5bef-4379-824e-24358d3a92bb
space_guid The guid of the associated space
  • guid-2aa76f30-616e-4493-88ed-0f89491d0e9a
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": "4d00590c-a4fe-4c2a-be08-d06778beeb2e",
  "space_guid": "93ea1f9a-81f0-4ae7-b583-765cd5470c3e",
  "path": "/apps/v1/path"
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "4d00590c-a4fe-4c2a-be08-d06778beeb2e",
  "space_guid": "93ea1f9a-81f0-4ae7-b583-765cd5470c3e",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIzNiIsImVtYWlsIjoiZW1haWwtMTgyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzI3NzQ5OTJ9.rs80ZExbbswCFmqIWVTxuGSc1AIvhBFbN9tCdRXANXE" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "13d57ffe-a132-4713-8195-2c38cd8cdc3b",
    "url": "/v2/routes/13d57ffe-a132-4713-8195-2c38cd8cdc3b",
    "created_at": "2015-05-21T01:03:12Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "4d00590c-a4fe-4c2a-be08-d06778beeb2e",
    "space_guid": "93ea1f9a-81f0-4ae7-b583-765cd5470c3e",
    "domain_url": "/v2/domains/4d00590c-a4fe-4c2a-be08-d06778beeb2e",
    "space_url": "/v2/spaces/93ea1f9a-81f0-4ae7-b583-765cd5470c3e",
    "apps_url": "/v2/routes/13d57ffe-a132-4713-8195-2c38cd8cdc3b/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/13d57ffe-a132-4713-8195-2c38cd8cdc3b
X-VCAP-Request-ID: dab7c92f-720e-46e1-ac45-b87a5c0c4610
Content-Length: 592
X-Content-Type-Options: nosniff