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-323cafd9-0d51-4bda-8967-842814d5e464
route_guid The guid of the bound route.
  • guid-e9f06c35-ba6a-4896-8786-9dc83f0b279d
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": "d232b485-b035-4d65-9f77-6b867d859de5",
  "route_guid": "c041e8a3-64d0-4beb-bac8-1900e3aedd07",
  "app_port": 8888
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTk2IiwiZW1haWwiOiJlbWFpbC02N0Bzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDUzODM3MjU5fQ.R-es8pa53sIEq1Fsk67DwTcIDk8keKEc4l-TyvA993o
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "d232b485-b035-4d65-9f77-6b867d859de5",
  "route_guid": "c041e8a3-64d0-4beb-bac8-1900e3aedd07",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTk2IiwiZW1haWwiOiJlbWFpbC02N0Bzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDUzODM3MjU5fQ.R-es8pa53sIEq1Fsk67DwTcIDk8keKEc4l-TyvA993o" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "ca9cdd28-53c4-4b8e-a7e0-1838f69b8f91",
    "url": "/v2/route_mappings/ca9cdd28-53c4-4b8e-a7e0-1838f69b8f91",
    "created_at": "2016-01-19T19:40:59Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "d232b485-b035-4d65-9f77-6b867d859de5",
    "route_guid": "c041e8a3-64d0-4beb-bac8-1900e3aedd07",
    "app_url": "/v2/apps/d232b485-b035-4d65-9f77-6b867d859de5",
    "route_url": "/v2/routes/c041e8a3-64d0-4beb-bac8-1900e3aedd07"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/ca9cdd28-53c4-4b8e-a7e0-1838f69b8f91
X-VCAP-Request-ID: 
Content-Length: 496
X-Content-Type-Options: nosniff