To make any request to Roads Selection API, you must include the following information:
The number or ID of your Google Cloud project in the
X-Goog-User-Projectheader of the request. This value determines the project used for billing and usage quota calculations.An OAuth token in the
Authorizationheader of the request. For more information about using OAuth with Roads Selection API, see Use OAuth.A Google Cloud project number or ID in the request URL. This value specifies the project containing the selected-route. While this project is usually the same as the project specified in the
X-Goog-User-Projectheader, it is not required to be the same.The selected-route-id in the request URL. Whenever you perform an action on a specific selected route, you pass the ID of the selected-route as part of the request URL.
For example, to delete a selected route, issue the following request:
curl -X DELETE \ -H 'X-Goog-User-Project: PROJECT_NUMBER' \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID
Get the project number
To get the PROJECT_NUMBER of your Google Cloud project:
Go to the project's Overview page in the Cloud console.
If prompted, select your project.
The Project number and Project ID appear in the Project info area of the overview screen.
Get an OAuth token
For authentication, your API request must contain an OAuth token in the
Authorization header. For more, see Use OAuth.
For example, use the following gcloud command to generate the token:
gcloud auth application-default print-access-token
You can include the gcloud command directly in the Authorization header in a
cURL command to generate a new token on each request, as shown in the example
above.
Alternatively, you can set an environment variable containing the token and then pass the environment variable as part of the request:
export TOKEN=$(gcloud auth application-default print-access-token)
curl -X DELETE \
-H 'X-Goog-User-Project: PROJECT_NUMBER' \
-H "Authorization: Bearer $TOKEN" \
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID