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-d6ce9dd7-dd63-47b3-8e4c-4f4b1cdc0cd8
route_guid The guid of the bound route.
  • guid-3306760a-5b97-4bc9-a70a-6e35452c6029
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": "cc3f1a2f-eabd-4faa-aa57-111b9c6d7ed5",
  "route_guid": "4c7fb524-3630-4a32-a331-529886400ecd",
  "app_port": 8888
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "cc3f1a2f-eabd-4faa-aa57-111b9c6d7ed5",
  "route_guid": "4c7fb524-3630-4a32-a331-529886400ecd",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM2MSIsImVtYWlsIjoiZW1haWwtMjYzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjE5NTg0MTF9.W3ysWBscxhYrXFFVw50rAWyr820lj0uGer0gDGeGPsw" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "db78b4fd-00c0-4d4a-a73a-05260e56aa7e",
    "url": "/v2/route_mappings/db78b4fd-00c0-4d4a-a73a-05260e56aa7e",
    "created_at": "2016-04-22T19:33:31Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "cc3f1a2f-eabd-4faa-aa57-111b9c6d7ed5",
    "route_guid": "4c7fb524-3630-4a32-a331-529886400ecd",
    "app_url": "/v2/apps/cc3f1a2f-eabd-4faa-aa57-111b9c6d7ed5",
    "route_url": "/v2/routes/4c7fb524-3630-4a32-a331-529886400ecd"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/db78b4fd-00c0-4d4a-a73a-05260e56aa7e
X-VCAP-Request-ID: 8235eed5-d2ae-4df1-8cdf-35f1bb1e3809
Content-Length: 496
X-Content-Type-Options: nosniff