Dopo aver creato un percorso, puoi utilizzare l'endpoint GET dell'API di selezione delle strade per ottenere le relative informazioni e monitorare lo stato di convalida.
Questa pagina descrive come elencare tutti i percorsi selezionati nel progetto e come ottenere i dettagli di un percorso selezionato specifico.
Ottenere un percorso selezionato specifico
Per ottenere informazioni su un percorso selezionato specifico, invia una GET richiesta all'
get endpoint includendo il selectedRouteId del percorso che vuoi
recuperare.
"https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID"
Il seguente esempio di codice mostra la struttura di una richiesta GET all'endpoint
get per ottenere informazioni su un singolo percorso selezionato.
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"
Il seguente esempio di codice mostra la struttura di una
get risposta dell'endpoint con le informazioni di un singolo percorso selezionato.
{
"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"
}
Elencare i percorsi selezionati
Per elencare tutti i percorsi selezionati associati al tuo progetto, invia una GET
richiesta all'list endpoint.
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes
Il seguente esempio di codice mostra la struttura di una richiesta GET all'endpoint
list per ottenere le informazioni di tutti i percorsi selezionati
associati a un progetto Google Cloud.
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"
Il seguente esempio di codice mostra la struttura di una risposta dell'endpoint list
con le informazioni di tutti i percorsi selezionati associati a un progetto Google Cloud.
{
"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"
},
]
}