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
guid The guid of the route mapping.
app_guid The guid of the bound application.
  • guid-585a5321-8c2d-4cb7-97a8-ac0877ab771b
route_guid The guid of the bound route.
  • guid-f8c93e37-bd89-40a3-a07a-e0ca1580a326
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": "c6b83bc7-d40c-44f1-8a96-a92a96dc7612",
  "route_guid": "19cb55f4-2c0a-4d84-83be-2d8dbdc12879",
  "app_port": 8888
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMzNSIsImVtYWlsIjoiZW1haWwtMjM4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTQ0NTE2MzB9.3Zshd-wAPIbZJb89f4Zcm_sD95Pv8D9xgF8NY9qMCZI
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "c6b83bc7-d40c-44f1-8a96-a92a96dc7612",
  "route_guid": "19cb55f4-2c0a-4d84-83be-2d8dbdc12879",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTMzNSIsImVtYWlsIjoiZW1haWwtMjM4QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTQ0NTE2MzB9.3Zshd-wAPIbZJb89f4Zcm_sD95Pv8D9xgF8NY9qMCZI" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "9af3adb3-0c9f-4028-bdaa-0774c69b2441",
    "url": "/v2/route_mappings/9af3adb3-0c9f-4028-bdaa-0774c69b2441",
    "created_at": "2016-01-26T22:20:29Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "c6b83bc7-d40c-44f1-8a96-a92a96dc7612",
    "route_guid": "19cb55f4-2c0a-4d84-83be-2d8dbdc12879",
    "app_url": "/v2/apps/c6b83bc7-d40c-44f1-8a96-a92a96dc7612",
    "route_url": "/v2/routes/19cb55f4-2c0a-4d84-83be-2d8dbdc12879"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/9af3adb3-0c9f-4028-bdaa-0774c69b2441
X-VCAP-Request-ID: 
Content-Length: 496
X-Content-Type-Options: nosniff