Setelah membuat rute, Anda dapat menggunakan endpoint GET Roads Selection API untuk mendapatkan informasinya dan memantau status validasinya.
Halaman ini menjelaskan cara mencantumkan semua rute yang dipilih dalam project Anda dan cara mendapatkan detail untuk rute tertentu yang dipilih.
Mendapatkan rute tertentu yang dipilih
Untuk mendapatkan informasi tentang rute tertentu yang dipilih, kirim permintaan GET ke endpoint
get yang menyertakan selectedRouteId rute yang ingin Anda ambil.
"https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID"
Contoh kode berikut menunjukkan struktur permintaan GET ke endpoint
get untuk mendapatkan informasi tentang satu rute yang dipilih.
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"
Contoh kode berikut menunjukkan struktur respons endpoint
get dengan informasi satu rute yang dipilih.
{
"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"
}
Mencantumkan rute yang dipilih
Untuk mencantumkan semua rute yang dipilih yang terkait dengan project Anda, kirim GET
permintaan ke list endpoint.
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes
Contoh kode berikut menunjukkan struktur permintaan GET ke
list endpoint untuk mendapatkan informasi tentang semua rute yang dipilih
yang terkait dengan project 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"
Contoh kode berikut menunjukkan struktur respons endpoint list
dengan informasi semua rute yang dipilih yang terkait dengan project 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"
},
]
}