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-2926a52b-740c-432a-a925-54672628d5ae
space_guid The guid of the associated space
  • guid-2275fe62-b1e7-41ea-aa00-f10e9205f792
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": "81ac950d-fa30-4c57-a8cb-2c4991620d29",
  "space_guid": "ad0ea1d6-73bd-4fc8-83dd-08d73c82dd7b",
  "port": 10000
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "81ac950d-fa30-4c57-a8cb-2c4991620d29",
  "space_guid": "ad0ea1d6-73bd-4fc8-83dd-08d73c82dd7b",
  "port": 10000
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTczIiwiZW1haWwiOiJlbWFpbC03MUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDQ3MTE2ODMzfQ.s9gRzwcdLhfCt_nkyprsZtanECRWORMw_21ys2S4Cbg" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "7810a92b-e9a1-4d05-91b6-c3e1d284fc3f",
    "url": "/v2/routes/7810a92b-e9a1-4d05-91b6-c3e1d284fc3f",
    "created_at": "2015-11-03T00:53:53Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "",
    "domain_guid": "81ac950d-fa30-4c57-a8cb-2c4991620d29",
    "space_guid": "ad0ea1d6-73bd-4fc8-83dd-08d73c82dd7b",
    "service_instance_guid": null,
    "port": 10000,
    "domain_url": "/v2/domains/81ac950d-fa30-4c57-a8cb-2c4991620d29",
    "space_url": "/v2/spaces/ad0ea1d6-73bd-4fc8-83dd-08d73c82dd7b",
    "apps_url": "/v2/routes/7810a92b-e9a1-4d05-91b6-c3e1d284fc3f/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/7810a92b-e9a1-4d05-91b6-c3e1d284fc3f
X-VCAP-Request-ID: 3721fd53-6b5f-47fc-909f-74f0968dfaf1
Content-Length: 633
X-Content-Type-Options: nosniff