Get selected routes

After you create a route, you can use the Roads Selection API GET endpoint to get its information and monitor its validation status.

This page describes how to list all the selected routes in your project and how to get details for a specific selected route.

Get a specific selected route

To get information about a specific selected route, send a GET request to the get endpoint including the selectedRouteId of the route you want to retrieve.

  "https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID"

The following code sample shows the structure of a GET request to the get endpoint to get information about a single selected route.

curl -X GET \
-H 'X-Goog-User-Project: PROJECT_NUMBER' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
"https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID"

The following code sample shows the structure of a get endpoint response with the information of a single selected route.

{
  "name": "projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID",
  "dynamicRoute": {
    "origin": {
      "latitude": ORIGIN_LATITUDE,
      "longitude": ORIGIN_LONGITUDE
    },
    "destination": {
      "latitude": DESTINATION_LATITUDE,
      "longitude": DESTINATION_LONGITUDE
    },
    "intermediates": [
      {
        "latitude": LATITUDE,
        "longitude": LONGITUDE
      },
      {
        "latitude": LATITUDE,
        "longitude": LONGITUDE
      },
      {
        "latitude": LATITUDE,
        "longitude": LONGITUDE
      }
    ]
  },
  "createTime": "CREATE_TIME",
  "state": "STATE"

}

List selected routes

To list all selected routes associated with your project, send a GET request to the list endpoint.

https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes

The following code sample shows the structure of a GET request to the list endpoint to get the information of all the selected routes associated with a Google Cloud project.

curl -X GET \
-H 'X-Goog-User-Project: PROJECT_NUMBER' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
"https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes"

The following code sample shows the structure of a list endpoint response with the information of all the selected routes associated to a Google Cloud project.

{
  "selectedRoutes": [
    {
      "name": "projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID",
      "dynamicRoute": {
        "origin": {
          "latitude": ORIGIN_LATITUDE,
          "longitude": ORIGIN_LONGITUDE
        },
        "destination": {
          "latitude": DESTINATION_LATITUDE,
          "longitude": DESTINATION_LONGITUDE
        }
      },
      "createTime": "CREATE_TIME",
      "state": "STATE"
    },
    {
      "name": "projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID",
      "dynamicRoute": {
        "origin": {
          "latitude": ORIGIN_LATITUDE,
          "longitude": ORIGIN_LONGITUDE
        },
        "destination": {
          "latitude": DESTINATION_LATITUDE,
          "longitude": DESTINATION_LONGITUDE
        },
        "intermediates": [
          {
            "latitude": LATITUDE,
            "longitude": LONGITUDE
          },
          {
            "latitude": LATITUDE,
            "longitude": LONGITUDE
          },
          {
            "latitude": LATITUDE,
            "longitude": LONGITUDE
          }
        ]
      },
      "createTime": "CREATE_TIME",
      "state": "STATE"
    },
  ]
}