Predict
POSThttps://api.uber.com/v2/eta/predict
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? |
origin |
ULocation |
coordinates for Origin/starting location. |
Yes |
destination |
ULocation |
coordinates for destination location. |
Yes |
vehicle |
Vehicle |
Type of vehicle to be used for estimate. |
No |
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/v2/eta/predict -d
'{
"destination": {
"latitude": 37.79507,
"longitude": -122.40349
},
"origin": {
"latitude": 37.7891,
"longitude": -122.40684
},
"vehicle": {
"type": "FOOT"
}
}'
Response body parameters
| Name |
Type |
Description |
Required? |
status |
string |
Response status [OK/ERROR] |
Yes |
eta |
integer |
Postprocessed ETA in seconds.Postprocessing model is applied on initial graph search estimation. |
Yes |
unmodified_eta |
integer |
ETA returned from graph search |
Yes |
distance |
double |
Postprocessed routeable distance |
Yes |
unmodified_distance |
double |
Routeable distance returned from graph search |
Yes |
Status-code: 200 OK
{
"status": "OK",
"eta": 894,
"unmodified_eta": 894,
"distance": 995,
"unmodified_distance": 995
}