Home
Version 3
Routes API

Routes API

Creating a Route

POST /v2/routes/

Request

Route

POST /v2/routes

Body

Name Description Default Valid Values Example Values
guid The guid of the route.
domain_guid The guid of the associated domain
  • guid-4016d3de-df07-4d77-9986-278653d69885
space_guid The guid of the associated space
  • guid-21d8cb5a-cdb9-44e7-b5aa-53a0e4b8459f
host The host portion of the route
path The path for a route as raw text. 1) Paths must be between 2 and 128 characters 2) Paths must start with a / 3) Paths must not contain a "?"
  • /apps/v1/path
  • /apps/v2/path
service_instance_guid Guid of the bound service instance. Requests for the route will be forwarded to this service instance.
{
  "domain_guid": "742d6d82-9b94-40cd-bea9-69aceedda5bc",
  "space_guid": "d6754fe0-d5e2-4aca-915e-41f79c17f75f",
  "path": "/apps/v1/path",
  "service_instance_guid": "a8785083-d779-4cfd-b2b0-2da344df3a2e"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM2NSIsImVtYWlsIjoiZW1haWwtMjU2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDE2NjI2MTZ9.9c5BYewmi0fHh1UiB05lUs-0BIgOR83ETPR8_YsbeVQ
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/routes" -d '{
  "domain_guid": "742d6d82-9b94-40cd-bea9-69aceedda5bc",
  "space_guid": "d6754fe0-d5e2-4aca-915e-41f79c17f75f",
  "path": "/apps/v1/path",
  "service_instance_guid": "a8785083-d779-4cfd-b2b0-2da344df3a2e"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTM2NSIsImVtYWlsIjoiZW1haWwtMjU2QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDE2NjI2MTZ9.9c5BYewmi0fHh1UiB05lUs-0BIgOR83ETPR8_YsbeVQ" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "2255085f-2b3d-47a4-a9b7-ebfffda9063e",
    "url": "/v2/routes/2255085f-2b3d-47a4-a9b7-ebfffda9063e",
    "created_at": "2015-08-31T21:50:15Z",
    "updated_at": null
  },
  "entity": {
    "host": "",
    "path": "/apps/v1/path",
    "domain_guid": "742d6d82-9b94-40cd-bea9-69aceedda5bc",
    "space_guid": "d6754fe0-d5e2-4aca-915e-41f79c17f75f",
    "service_instance_guid": "a8785083-d779-4cfd-b2b0-2da344df3a2e",
    "domain_url": "/v2/domains/742d6d82-9b94-40cd-bea9-69aceedda5bc",
    "space_url": "/v2/spaces/d6754fe0-d5e2-4aca-915e-41f79c17f75f",
    "service_instance_url": "/v2/service_instances/a8785083-d779-4cfd-b2b0-2da344df3a2e",
    "apps_url": "/v2/routes/2255085f-2b3d-47a4-a9b7-ebfffda9063e/apps"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/routes/2255085f-2b3d-47a4-a9b7-ebfffda9063e
X-VCAP-Request-ID: 46062490-a23b-46cb-92f2-9fcb456930d6
Content-Length: 751
X-Content-Type-Options: nosniff