This page describes how to stop data collection using the Roads Selection API:
- Delete a route: Stop data collection for a single route using the
deleteendpoint. - Batch delete routes: Stop data collection for multiple routes in
a single request using the
batchDeleteendpoint.
Delete a route
Send a DELETE request to the delete endpoint to delete a selected route
from your project and stop data collection.
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID
The request must include the project number and the name of the
SelectedRoute to delete.
The following code sample shows the structure of a DELETE request to the
delete endpoint:
curl -X DELETE \ -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"
On success, the API returns an empty JSON object.
Batch delete routes
To delete multiple routes in a single request, use the
batchDelete
endpoint. This endpoint lets you delete up to 1,000 routes in one call. Batch
deletion is atomic: if any route in the batch request fails or is missing,
no routes in the batch are deleted.
Send a POST request to the batchDelete endpoint:
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes:batchDelete
The request body must be a JSON object containing a names array.
Each string element within this array is the name of a
SelectedRoute to be deleted.
The following code sample shows the structure of a POST request to the
batchDelete endpoint:
curl -X POST -d '
{"names": [
"projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID_1",
"projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID_2"
]}' \
-H 'X-Goog-User-Project: PROJECT_NUMBER' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
"https://roads.googleapis.com/selection/v1/projects/"\
"PROJECT_NUMBER/selectedRoutes:batchDelete"On success, the API returns an empty JSON object. Data collection on the deleted route stops immediately. Permanent resource deletion completes in the background, and can take a few minutes to complete for large batch sizes.
Use the
get
operation to check the status of your route. Retrying a request after permanent
deletion has finished returns a 404 Not Found error, confirming that resource
deletion is complete.