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-d98d425a-ad80-4f55-a6fa-dc3e64660958
route_guid The guid of the bound route.
  • guid-4d87df3e-8efc-401d-8a93-8c787fae840b
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": "55c371df-b1b8-4df9-bbdb-787f0c8147f2",
  "route_guid": "8c176a54-d869-457b-991e-540d661edd3c",
  "app_port": 8888
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxNSIsImVtYWlsIjoiZW1haWwtMjg0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjA1MDY2NjB9.2l1HqXHamncaV-YsE4Fv51mmksyQee9gAV6-AA_VgM0
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "55c371df-b1b8-4df9-bbdb-787f0c8147f2",
  "route_guid": "8c176a54-d869-457b-991e-540d661edd3c",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQxNSIsImVtYWlsIjoiZW1haWwtMjg0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjA1MDY2NjB9.2l1HqXHamncaV-YsE4Fv51mmksyQee9gAV6-AA_VgM0" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "04186c80-25d1-4634-88b7-2e4976f2fcc2",
    "url": "/v2/route_mappings/04186c80-25d1-4634-88b7-2e4976f2fcc2",
    "created_at": "2016-04-06T00:17:40Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "55c371df-b1b8-4df9-bbdb-787f0c8147f2",
    "route_guid": "8c176a54-d869-457b-991e-540d661edd3c",
    "app_url": "/v2/apps/55c371df-b1b8-4df9-bbdb-787f0c8147f2",
    "route_url": "/v2/routes/8c176a54-d869-457b-991e-540d661edd3c"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/04186c80-25d1-4634-88b7-2e4976f2fcc2
X-VCAP-Request-ID: 
Content-Length: 496
X-Content-Type-Options: nosniff