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-9381257e-6247-4010-b209-3fb17addf47f
route_guid The guid of the bound route.
  • guid-83eeb8da-104b-48da-8c95-3258b4761104
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": "4c4e083f-3638-4a0b-bd3a-ac3c0a680b1b",
  "route_guid": "ae4ec3ea-938f-4465-a912-42b27d9e26b4",
  "app_port": 8888
}

Headers

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

cURL

curl "https://api.[your-domain.com]/v2/route_mappings" -d '{
  "app_guid": "4c4e083f-3638-4a0b-bd3a-ac3c0a680b1b",
  "route_guid": "ae4ec3ea-938f-4465-a912-42b27d9e26b4",
  "app_port": 8888
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTEwMiIsImVtYWlsIjoiZW1haWwtNjZAc29tZWRvbWFpbi5jb20iLCJzY29wZSI6WyJjbG91ZF9jb250cm9sbGVyLmFkbWluIl0sImF1ZCI6WyJjbG91ZF9jb250cm9sbGVyIl0sImV4cCI6MTQ2MTM3NDYyNn0.xIN7dVeduTX2E8h1zKi4bLwfrNPKEyZVsRhMCtqanbY" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "63b6a10a-68de-475a-87cf-cff82749bf5d",
    "url": "/v2/route_mappings/63b6a10a-68de-475a-87cf-cff82749bf5d",
    "created_at": "2016-04-16T01:23:46Z",
    "updated_at": null
  },
  "entity": {
    "app_port": 8888,
    "app_guid": "4c4e083f-3638-4a0b-bd3a-ac3c0a680b1b",
    "route_guid": "ae4ec3ea-938f-4465-a912-42b27d9e26b4",
    "app_url": "/v2/apps/4c4e083f-3638-4a0b-bd3a-ac3c0a680b1b",
    "route_url": "/v2/routes/ae4ec3ea-938f-4465-a912-42b27d9e26b4"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/route_mappings/63b6a10a-68de-475a-87cf-cff82749bf5d
X-VCAP-Request-ID: 17421b01-c457-470e-a9d2-1729d23d0ec6
Content-Length: 496
X-Content-Type-Options: nosniff