Ottenere i percorsi selezionati

Dopo aver creato un percorso, puoi utilizzare l'endpoint GET dell'API Roads Selection per ottenere le relative informazioni e monitorare lo stato di convalida.

Questa pagina descrive come elencare tutte le route selezionate nel progetto e come ottenere i dettagli di una route selezionata specifica.

Ottieni un percorso selezionato specifico

Per ottenere informazioni su una route selezionata specifica, invia una richiesta GET all'endpoint get includendo il selectedRouteId della route 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 risposta dell'endpoint get 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",
  "dynamicRouting": TRUE_OR_FALSE
}

Elenca le route selezionate

Per elencare tutti i percorsi selezionati associati al tuo progetto, invia una richiesta GET all'endpoint list.

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 tutte le route selezionate associate 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 tutte le route selezionate associate 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",
      "dynamicRouting": TRUE_OR_FALSE
    },
    {
      "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",
      "dynamicRouting": TRUE_OR_FALSE
    }
  ]
}