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-b82d726f-9ef2-44f4-84d6-b281b616c5f0
route_guid The guid of the bound route.
  • guid-c715384a-72c9-4aef-8751-b986c5d7d355
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": "6aa14db3-a480-4ab1-8b55-13edf3b0d318",
  "route_guid": "fea8b4c0-a9b8-4588-8f4e-2fb573f70cc4",
  "app_port": 8888
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI5NCIsImVtYWlsIjoiZW1haWwtMjAxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg4NTU2ODF9.dmigCuSOm7RaQzrFCPh1TL4FqVXkB0MRhnz-XTyImUo
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "6aa14db3-a480-4ab1-8b55-13edf3b0d318",
  "route_guid": "fea8b4c0-a9b8-4588-8f4e-2fb573f70cc4",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTI5NCIsImVtYWlsIjoiZW1haWwtMjAxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NTg4NTU2ODF9.dmigCuSOm7RaQzrFCPh1TL4FqVXkB0MRhnz-XTyImUo" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "3dfcd0d0-3c2b-4934-a21b-7214deb4e680",
    "url": "/v2/route_mappings/3dfcd0d0-3c2b-4934-a21b-7214deb4e680",
    "created_at": "2016-03-17T21:41:21Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "6aa14db3-a480-4ab1-8b55-13edf3b0d318",
    "route_guid": "fea8b4c0-a9b8-4588-8f4e-2fb573f70cc4",
    "app_url": "/v2/apps/6aa14db3-a480-4ab1-8b55-13edf3b0d318",
    "route_url": "/v2/routes/fea8b4c0-a9b8-4588-8f4e-2fb573f70cc4"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/3dfcd0d0-3c2b-4934-a21b-7214deb4e680
X-VCAP-Request-ID: 
Content-Length: 496
X-Content-Type-Options: nosniff