为了测试我输入的网址是否正确,我将它们放在浏览器中以查看是否可以获取结果。
首先,我尝试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 COORDINATES和SAME SERVER TOEKN来创建如下网址:
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,以防该位置可能会影响结果。
该GET /v1/estimates/time
端点具有这可能是为什么它没有对中国工作场所区域的依赖。在China Developer仪表板上创建您的应用程序后,请尝试使用:https : //developer.uber.com.cn/并将该服务器令牌与一起使用api.uber.com.cn
。
可以在这里找到有关此文档:https : //developer.uber.com/docs/china
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句