1
votes

I have successfully completed the first three steps of the authentication process: step one(authorize), step two (receive redirect ) and step three (get an access token).

But, doing the following request gives me an error:

curl -H 'Authorization: Bearer xxxxoKnAKxxxxxndQNRZgRa0Dxxxxx' 'https://sandbox-api.uber.com/v1/requests'

Response:

{"message":"Not supported","code":"not_found"}

I have the same message with all required params:

curl -H 'Authorization: Bearer xxxxoKnAKxxxxxndQNRZgRa0Dxxxxx' 'https://sandbox-api.uber.com/v1/requests?product_id=5b451799-a7c3-480e-8720-891f2b51abb4&start_latitude=48.869576&start_longitude=2.30825&end_latitude=48.84839&end_longitude=2.395921'

Am I missing something?

Edit: Ruby version with HTTParty:

def request(bearer, product_id="5b451799-a7c3-480e-8720-891f2b51abb4", start_latitude=48.869576, start_longitude=2.30825, end_latitude=48.84839, end_longitude=2.395921)
  parameters =  { product_id: product_id,
                start_latitude: start_latitude,
                start_longitude: start_longitude,
                end_latitude: end_latitude,
                end_longitude: end_longitude
              }
  self.class.post('/v1/requests', query: parameters, headers: { "Authorization" => "Bearer #{bearer}", 'Content-Type' => 'application/json' })
end
1
I'm currently getting the same, did the same API work for you in the past? - SomeGuy
@SomeGuy: I use it for the first time - user3671545

1 Answers

1
votes

A GET to 'https://sandbox-api.uber.com/v1/requests' won't work since you need to include a such as https://sandbox-api.uber.com/v1/requests/request_id

A POST to 'https://sandbox-api.uber.com/v1/requests' requires you to post the parameters as part of the JSON body.

Once you have the request ID as part of the response, you will able poll for details using the first command.