Ottenere i percorsi selezionati

Dopo aver creato un percorso, puoi utilizzare l'endpoint dell'API Roads Selection GET 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.

Ottenere un percorso specifico selezionato

Per ottenere informazioni su un percorso specifico selezionato, invia una richiesta GET all'endpoint get includendo l'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 risposta dell'endpoint get con le informazioni di un singolo itinerario 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"

}

Elenca le route selezionate

Per elencare tutte le route selezionate associate 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"
    },
    {
      "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"
    },
  ]
}