【问题标题】:Uber API /v1/estimates/time responds No authentication providedUber API /v1/estimates/time 响应 未提供身份验证
【发布时间】:2016-08-02 11:04:57
【问题描述】:

为了测试我做的url是否正确,我把它们放在我的浏览器中,看看能不能得到结果。

首先,我尝试了GET /v1/products,它应该返回所有类型的汽车,然后我将它放在浏览器中,如下所示:

https://api.uber.com/v1/products?server_token=MY_TOKEN&latitude=39.914286&longitude=116.461745

效果很好,给了我大量的产品 JSON:

{"products":[{"capacity":4,"product_id":"0ed2dbad-c769-41f5-b66d-0767da627f9e","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-peoplesuber2.png","short_description":"People's Uber +","display_name":"People\u2019s Uber +","description":"People's Uber +"},{"capacity":4,"product_id":"6bf8dc3b-c8b0-4f37-9b61-579e64016f7a","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-peoplesuber2.png","short_description":"People's Uber","display_name":"People's Uber","description":"People's Uber"},{"capacity":4,"product_id":"93a40036-2670-4a41-bc59-1e901ca33632","price_details":{"service_fees":[],"cost_per_minute":0.4,"distance_unit":"km","minimum":20.0,"cost_per_distance":2.3,"base":15.0,"cancellation_fee":15.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-china-uberx.png","short_description":"uberX","display_name":"uberX","description":"The low-cost Uber"},{"capacity":4,"product_id":"259df3b5-e062-4b2b-ab81-3e3fbba4b423","price_details":{"service_fees":[],"cost_per_minute":0.7,"distance_unit":"km","minimum":30.0,"cost_per_distance":3.85,"base":18.0,"cancellation_fee":20.0,"currency_code":"CNY"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-black.png","short_description":"UberBLACK","display_name":"UberBLACK","description":"The original Uber"},{"capacity":4,"product_id":"d1b0005e-8e33-44f1-b1e5-b3f98138642a","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-electric.png","short_description":"Electric Vehicles","display_name":"a","description":"a"}]}

然后,我尝试了GET /v1/estimates/time,使用SAME COORDINATESSAME SERVER TOEKN,我将网址设为: p>

https://api.uber.com/v1/estimates/time?server_token=MY_TOKEN&start_latitude=39.914286&start_longitude=116.461745

但它会返回:

{"message":"No authentication provided.","code":"unauthorized"}

如果令牌已过期,它不应该与实际上运行良好的Products API 一起使用,所以我认为这不是问题所在。请帮忙,谢谢。

顺便说一句,我正在中国测试 Uber API,以防位置可能影响这里的结果。

【问题讨论】:

  • 它识别 CDN 问题。查看您的 developer.uber.com API 设置。因为对我来说它工作正常。 uberestimate.org 这是我的网站,对我来说运行良好。

标签: uber-api


【解决方案1】:

GET /v1/estimates/time 端点具有区域依赖性,这可能是它不适用于中国位置的原因。在中国开发者仪表板上创建您的应用程序后尝试一下:https://developer.uber.com.cn/ 并将该服务器令牌与api.uber.com.cn 一起使用。

可在此处找到相关文档:https://developer.uber.com/docs/china

【讨论】:

  • 谢谢,我按照你说的做了,服务器返回了完整的信息。
猜你喜欢
  • 2017-02-18
  • 2017-04-18
  • 1970-01-01
  • 2021-01-06
  • 2018-11-28
  • 2020-07-22
  • 2021-11-29
  • 2019-04-26
  • 2020-01-11
相关资源
最近更新 更多