Home
Version 3
Routes Mapping API

Routes Mapping API

Mapping an App and a Route

POST /v2/route_mappings

Request

Route

POST /v2/route_mappings

Body

Name Description Default Valid Values Example Values
app_guid The guid of the bound application.
  • guid-69d9d8ea-e6cb-448c-afe5-c6d4f37bfc74
route_guid The guid of the bound route.
  • guid-e724536c-2dd6-4763-94c5-2c7537ed82fc
app_port Port on which the application should listen, and to which requests for the mapped route will be routed. Must be among those already configured for the app. If a port is not specified when mapping the route, the first one in the list of those configured for the app will be chosen.
{
  "app_guid": "9c4e6c91-d6bf-48e8-9900-039b086b1b7c",
  "route_guid": "01737974-a404-4d1c-9c39-8f7a4a07c3ae",
  "app_port": 8888
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTgwIiwiZW1haWwiOiJlbWFpbC03OUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDU2NDUyMjI3fQ.U1lnyYgRp6nUekB7jUXXIt5e8RfpFrnca9Q9r-i-S3c
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "9c4e6c91-d6bf-48e8-9900-039b086b1b7c",
  "route_guid": "01737974-a404-4d1c-9c39-8f7a4a07c3ae",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTgwIiwiZW1haWwiOiJlbWFpbC03OUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDU2NDUyMjI3fQ.U1lnyYgRp6nUekB7jUXXIt5e8RfpFrnca9Q9r-i-S3c" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "87b7bfb9-8a11-42da-89bd-4a7df73b703b",
    "url": "/v2/route_mappings/87b7bfb9-8a11-42da-89bd-4a7df73b703b",
    "created_at": "2016-02-19T02:03:47Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "9c4e6c91-d6bf-48e8-9900-039b086b1b7c",
    "route_guid": "01737974-a404-4d1c-9c39-8f7a4a07c3ae",
    "app_url": "/v2/apps/9c4e6c91-d6bf-48e8-9900-039b086b1b7c",
    "route_url": "/v2/routes/01737974-a404-4d1c-9c39-8f7a4a07c3ae"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/87b7bfb9-8a11-42da-89bd-4a7df73b703b
X-VCAP-Request-ID: 
Content-Length: 496
X-Content-Type-Options: nosniff