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-8a5503fc-0347-46e8-90b6-3bf2c823bd7b
route_guid The guid of the bound route.
  • guid-7a18f330-0038-4db5-8bf1-d969b822c058
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": "d5035f80-4e50-436b-924f-ca31fe1eb25a",
  "route_guid": "fb5dae35-6ef2-4140-abf1-f71658996044",
  "app_port": 8888
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEiLCJlbWFpbCI6ImVtYWlsLTFAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2MzYxODcwM30.dY0v5Hk3EJb-mUbR8tdhHTNqRLMgiS9rnWWG3_AZSDM
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "d5035f80-4e50-436b-924f-ca31fe1eb25a",
  "route_guid": "fb5dae35-6ef2-4140-abf1-f71658996044",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEiLCJlbWFpbCI6ImVtYWlsLTFAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2MzYxODcwM30.dY0v5Hk3EJb-mUbR8tdhHTNqRLMgiS9rnWWG3_AZSDM" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "e78de224-9d36-4dfb-a2e2-3e0eae29e9f9",
    "url": "/v2/route_mappings/e78de224-9d36-4dfb-a2e2-3e0eae29e9f9",
    "created_at": "2016-05-12T00:45:03Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "d5035f80-4e50-436b-924f-ca31fe1eb25a",
    "route_guid": "fb5dae35-6ef2-4140-abf1-f71658996044",
    "app_url": "/v2/apps/d5035f80-4e50-436b-924f-ca31fe1eb25a",
    "route_url": "/v2/routes/fb5dae35-6ef2-4140-abf1-f71658996044"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/e78de224-9d36-4dfb-a2e2-3e0eae29e9f9
X-VCAP-Request-ID: 4da335a8-5674-453e-87e4-07f510f65745
Content-Length: 496
X-Content-Type-Options: nosniff