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-32f92da4-e5f0-452a-b252-575397c5c720
space_guid The guid of the associated space
  • guid-f0e6f272-f73a-4517-9aa3-4dc20fd94f3c
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": "ab6e8bc4-6715-43e6-8e13-82a03a0ac334",
  "space_guid": "d6836842-ae07-49a6-9c6d-76c4345791b0",
  "path": "/apps/v1/path"
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "ab6e8bc4-6715-43e6-8e13-82a03a0ac334",
  "space_guid": "d6836842-ae07-49a6-9c6d-76c4345791b0",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM3NCIsImVtYWlsIjoiZW1haWwtMjQyQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDQyNjA2NTR9._XGExyBUjOwt5BwJgmoK5bk1imZpvqZsJIixyS3M3IA" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "c1f260fb-b3ad-4207-8097-78e275119166",
    "url": "/v2/routes/c1f260fb-b3ad-4207-8097-78e275119166",
    "created_at": "2015-09-30T23:30:54Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "ab6e8bc4-6715-43e6-8e13-82a03a0ac334",
    "space_guid": "d6836842-ae07-49a6-9c6d-76c4345791b0",
    "service_instance_guid": null,
    "domain_url": "/v2/domains/ab6e8bc4-6715-43e6-8e13-82a03a0ac334",
    "space_url": "/v2/spaces/d6836842-ae07-49a6-9c6d-76c4345791b0",
    "apps_url": "/v2/routes/c1f260fb-b3ad-4207-8097-78e275119166/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/c1f260fb-b3ad-4207-8097-78e275119166
X-VCAP-Request-ID: 4601fb66-48ca-4ad2-90f3-2b922eb660e2
Content-Length: 627
X-Content-Type-Options: nosniff