1

我已经成功完成了身份验证过程的前三个步骤:第一步(授权)、第二步(接收重定向)和第三步(获取访问令牌)。

但是,执行以下请求会给我一个错误:

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

回复:

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

我对所有必需的参数都有相同的消息:

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'

我错过了什么吗?

编辑:带有 HTTParty 的 Ruby 版本:

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
4

1 回答 1

1

对“ https://sandbox-api.uber.com/v1/requests ”的 GET将不起作用,因为您需要包含诸如https://sandbox-api.uber.com/v1/requests/request_id之类的

到“ https://sandbox-api.uber.com/v1/requests ”的 POST要求您将参数作为 JSON 正文的一部分发布。

一旦您将请求 ID 作为响应的一部分,您就可以使用第一个命令轮询详细信息。

于 2015-05-22T23:10:44.777 回答