How do I request a time estimate for the next Uber X to a given location, from the Uber API?

85 views Asked by At

I'm trying to get the basics working of interfacing with the Uber API. I've registered my app with their Developer dashboard, and would just like to get it working with Postman, initially. My goal is to retrieve a time estimate for an Uber X to a given latitude and longitude (I can provide destination lat long if necessary).

I can't get a grip of how it's meant to work. The docs are confusing and I go in circles.

It seems I could use either:

First API endpoint

https://developer.uber.com/docs/riders/references/api/v1.2/estimates-time-get
i.e. GET https://api.uber.com/v1.2/estimates/time (no destination needed)

or

Second API endpoint

https://developer.uber.com/docs/guest-rides/references/api/v1/guest-trips-estimates-post
i.e. https://api.uber.com/v1/guests/trips/estimates (needs destination)

The first API endpoint implies there is a "Riders" API, but that is not an option on the home screen for the docs, which only offers "Guest Trips". I found the first endpoint docs via search. I assume Guest Trips is replacing Riders, and Riders is deprecated, but that is unclear. All the examples for Riders use server tokens, which they no longer issue.

The first API endpoint (Riders) does not specify what "scope" I would need permission to, while the second API endpoint (Guest Trips) says, "OAuth 2.0 Bearer token with the guests.trips scope".

I try to gain an OAuth 2.0 Bearer token to access the guest.trips scope, following their example:

curl -F 'client_secret=<my secret>' \
-F 'client_id=<my app id>' \
-F 'grant_type=client_credentials' \
-F 'scope=guests.trips'
https://login.uber.com/oauth/v2/token

That returns

{"error":"invalid_scope","error_description":"scope(s) are invalid"}

I tried it with 'scope=' (blank), in case that would give me a token to use with the first API endpoint, and get the same response.

The first endpoint has at the top, "Please contact your Uber Business Development representative or Uber point of contact to get access to this API.". The second endpoint does not have this warning, but implies a similar thing via "scopes".

The docs say I can get an OAuth token via, "Generate via the Developer Dashboard". I registered and created an app on this Dashboard. The Dashboard also says, "Please contact your Uber business development representative or Uber point of contact to request access."

Do Uber provide any API access without contacting them? And if they insist you contact them for access, how does one do that? There are no contact details for the API or Developer support anywhere online, that I could find. I've contacted Uber via DM on Twitter and in-app support without success.

0

There are 0 answers