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-0a8b68ed-a7e9-4b5b-9521-f16ec6165bd3
space_guid The guid of the associated space
  • guid-95e7b441-cec4-4ad5-9ba3-de15b3b09792
host The host portion of the route
port The port of the route. Supported for domains of TCP router groups only.
  • 1024-65535
  • 50000
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": "c7f0f6f9-6468-4c66-b7d8-b8842e64df76",
  "space_guid": "ff0b2fcc-6cbb-4087-a84c-832e4d665881",
  "path": "/apps/v1/path",
  "port": 10000
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "c7f0f6f9-6468-4c66-b7d8-b8842e64df76",
  "space_guid": "ff0b2fcc-6cbb-4087-a84c-832e4d665881",
  "path": "/apps/v1/path",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI0MCIsImVtYWlsIjoiZW1haWwtMTQ0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NDd9.cg1tDyceDab5Nuxv0nC3GFn7qDJp3s2vaRmjQWTvB0Y" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "4fa747e2-c77f-4d94-b8d7-80c07e606f30",
    "url": "/v2/routes/4fa747e2-c77f-4d94-b8d7-80c07e606f30",
    "created_at": "2015-10-15T23:52:27Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "c7f0f6f9-6468-4c66-b7d8-b8842e64df76",
    "space_guid": "ff0b2fcc-6cbb-4087-a84c-832e4d665881",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/c7f0f6f9-6468-4c66-b7d8-b8842e64df76",
    "space_url": "/v2/spaces/ff0b2fcc-6cbb-4087-a84c-832e4d665881",
    "apps_url": "/v2/routes/4fa747e2-c77f-4d94-b8d7-80c07e606f30/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/4fa747e2-c77f-4d94-b8d7-80c07e606f30
X-VCAP-Request-ID: 9ff83c50-190e-467f-b340-33f602afa40f
Content-Length: 646
X-Content-Type-Options: nosniff