Uber API:端点请求 returns 在沙盒环境中不受支持
Uber API: Endpoint requests returns Not supported in sandbox environment
我已成功完成身份验证过程的前三个步骤:第一步(授权)、第二步(接收重定向)和第三步(获取访问令牌)。
但是,执行以下请求会出现错误:
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'
我是不是漏掉了什么?
编辑:
Ruby 带有 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
GET 到 '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 到 'https://sandbox-api.uber.com/v1/requests' 要求您将 post 参数作为 JSON 正文的一部分。
将请求 ID 作为响应的一部分后,您将能够使用第一个命令轮询详细信息。
我已成功完成身份验证过程的前三个步骤:第一步(授权)、第二步(接收重定向)和第三步(获取访问令牌)。
但是,执行以下请求会出现错误:
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'
我是不是漏掉了什么?
编辑: Ruby 带有 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
GET 到 '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 到 'https://sandbox-api.uber.com/v1/requests' 要求您将 post 参数作为 JSON 正文的一部分。
将请求 ID 作为响应的一部分后,您将能够使用第一个命令轮询详细信息。