Use Case
The Predict endpoint returns routeable ETA and distance between given origin and destination using the provided vehicle.
Authorization
OAuth 2.0 Bearer token with the maps.routing scope.
Request Parameters
| Name |
Type |
Description |
Required? |
originDestinationPairs |
array |
list of origin destination pairs. |
Yes |
vehicle |
Vehicle |
Type of vehicle to be used for estimate. |
No |
OriginDestinationPairs Parameters
| Name |
Type |
Description |
Required? |
origin |
ULocation |
coordinates for Origin/starting location. |
Yes |
destination |
ULocation |
coordinates for destination location. |
Yes |
Ulocation Parameters
| Name |
Type |
Description |
Required? |
latitude |
double |
Latitude (-90,90). |
Yes |
longitude |
double |
Longitude (-180, 180). |
Yes |
headingAngle |
double |
heading angle for the location(0, 360). |
No |
Vehicle Parameters
| Name |
Type |
Description |
Required? |
type |
Type |
Vehicle type |
Yes |
Vehicle Type Options
| Name |
Type |
Description |
CAR |
String |
Car modality |
FOOT |
String |
Foot modality |
BICYCLE |
String |
Bicycle modality |
TRUCK |
String |
Truck modality |
| Name |
Type |
Description |
X-Uber-Origin |
String |
Identifier of the usecase for example: Upfront ETA, DisplayPage |
Example Request
curl -X POST \
-H "authorization: Bearer $UBER_TOKEN" \
-H 'content-type: application/json' \
-H 'X-Uber-Origin: $USECASE_IDENTIFIER' \
https://$api_url/v3/eta/predict-bulk -d
'{
"vehicle": {
"type": "CAR"
},
"originDestinationPairs": [
{
"origin": {
"latitude": 37.78103115613643,
"longitude": -122.47776015918855
},
"destination": {
"latitude": 37.75660581604907,
"longitude": -122.40360244434477
}
},
{
"origin": {
"latitude": 37.78537259414816,
"longitude": -122.4303816191495
},
"destination": {
"latitude": 37.791884273008236,
"longitude": -122.41458877246721
}
},
{
"origin": {
"latitude": 37.78103115613643,
"longitude": -122.47776015918855
},
"destination": {
"latitude": 37.75660581606907,
"longitude": -122.40360244434477
}
}]
}'
Response body parameters
| Name |
Type |
Description |
Required? |
request_uuid |
string |
uuid corresponding to request |
Yes |
routes[i].status |
string |
Response status [OK/ERROR] |
Yes |
routes[i].eta |
integer |
Postprocessed ETA in seconds.Postprocessing model is applied on initial graph search estimation. |
Yes |
routes[i].unmodified_eta |
integer |
ETA returned from graph search |
Yes |
routes[i].distance |
double |
Postprocessed routeable distance |
Yes |
routes[i].unmodified_distance |
double |
Routeable distance returned from graph search |
Yes |
routes[i].estimated_origin |
ULocation |
Road snapped location for the origin. |
Yes |
routes[i].estimated_destination |
Ulocation |
Road snapped location for the destination |
Yes |
Status-code: 200 OK
{
"request_uuid": "2728bdf8-bd99-4d83-9ba8-2e1d80c95e34",
"routes": [
{
"status": "OK",
"duration_seconds": 1828,
"unmodified_duration_seconds": 1856,
"distance_meters": 9248.64093333935,
"unmodified_distance_meters": 9248.64093333935,
"haversine_distance_meters": 7069.442509448157,
"estimated_origin": {
"latitude": 37.7811502,
"longitude": -122.4777181
},
"estimated_destination": {
"latitude": 37.7565783,
"longitude": -122.403776
}
},
{
"status": "OK",
"duration_seconds": 477,
"unmodified_duration_seconds": 490,
"distance_meters": 1998.596576919338,
"unmodified_distance_meters": 1998.596576919338,
"haversine_distance_meters": 1567.077484407875,
"estimated_origin": {
"latitude": 37.7855064,
"longitude": -122.4304104
},
"estimated_destination": {
"latitude": 37.7919278,
"longitude": -122.4142199
}
},
{
"status": "OK",
"duration_seconds": 1828,
"unmodified_duration_seconds": 1856,
"distance_meters": 9248.64093333935,
"unmodified_distance_meters": 9248.64093333935,
"haversine_distance_meters": 7069.442508591067,
"estimated_origin": {
"latitude": 37.7811502,
"longitude": -122.4777181
},
"estimated_destination": {
"latitude": 37.7565783,
"longitude": -122.403776
}
}
]
}