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-3ff2159e-91c3-4d7a-a660-86ca5339c383
space_guid The guid of the associated space
  • guid-77337542-b46c-4c16-869e-c5a44e41a336
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": "c83d6886-dbbf-4d5f-8e30-ba16085b56db",
  "space_guid": "6348d02a-d1f6-4d86-ad85-b8cc6c878586",
  "path": "/apps/v1/path"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTciLCJlbWFpbCI6ImVtYWlsLTdAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQzMjMxMzYwM30.2Xdb84rUx62yDvwtfbS_WtbcviuX2ZR8-UaJXAcEG3Y
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "c83d6886-dbbf-4d5f-8e30-ba16085b56db",
  "space_guid": "6348d02a-d1f6-4d86-ad85-b8cc6c878586",
  "path": "/apps/v1/path"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTciLCJlbWFpbCI6ImVtYWlsLTdAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQzMjMxMzYwM30.2Xdb84rUx62yDvwtfbS_WtbcviuX2ZR8-UaJXAcEG3Y" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "8aeeb4cb-0d35-438e-b942-641a1cfe8ed8",
    "url": "/v2/routes/8aeeb4cb-0d35-438e-b942-641a1cfe8ed8",
    "created_at": "2015-05-15T16:53:23Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "c83d6886-dbbf-4d5f-8e30-ba16085b56db",
    "space_guid": "6348d02a-d1f6-4d86-ad85-b8cc6c878586",
    "domain_url": "/v2/domains/c83d6886-dbbf-4d5f-8e30-ba16085b56db",
    "space_url": "/v2/spaces/6348d02a-d1f6-4d86-ad85-b8cc6c878586",
    "apps_url": "/v2/routes/8aeeb4cb-0d35-438e-b942-641a1cfe8ed8/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/8aeeb4cb-0d35-438e-b942-641a1cfe8ed8
X-VCAP-Request-ID: 00e70a4a-a391-4c6e-8aa7-0c5b9befb619
Content-Length: 592
X-Content-Type-Options: nosniff