查询所有产品,返回带有"upfront_fare_enabled“字段的列表。查询单品时,"upfront_fare_enabled“字段为"inverted”。看看下面的例子:
curl -H 'Authorization: Token xxx' 'https://sandbox-api.uber.com/v1.2/products?latitude=40.7413129&longitude=-73.9831658'
它返回(响应被修剪):
{
"products": [
{
"upfront_fare_enabled": false,
"product_id": "1508c51e-339a-4b91-b32a-a7d5e781e4c2",
"display_name": "uberPOOL"
},
{
"upfront_fare_enabled": true,
"product_id": "b8e5c464-5de2-4539-a35a-986d6e58f186",
"display_name": "uberX"
}
]
}但是,当我询问id = 1508c51e-339a-4b91-b32a-a7d5e781e4c2的产品时,其中upfront_fare_enabled是false,它将返回upfront_fare_enabled=true。
curl -H 'Authorization: Token xxx' 'https://sandbox-api.uber.com/v1.2/products/1508c51e-339a-4b91-b32a-a7d5e781e4c2'
{
"upfront_fare_enabled": true,
"product_id": "1508c51e-339a-4b91-b32a-a7d5e781e4c2",
"display_name": "uberPOOL"
}这是预期的行为吗?在我看来,这是API中的一个bug。
发布于 2017-06-28 01:22:14
感谢您分享您的调查结果-我们将审查GET /v1.2/products/{product_id}端点。要通过'POST /v1.2/requests/estimate‘获取预付费用,请使用'upfront_fare_enabled’的信息,通过查看GET /v1.2/products查看哪些产品已启用预付费用。如果该产品未启用预付费,您将得到如下响应:
'{“消息”:“无效产品\"1508c51e-339a-4b91-b32a-a7d5e781e4c2\”,可选: 0e9d8dd3-xxx",“代码”:"not_found“}‘
您还可以阅读有关前期票价here的最佳实践。
https://stackoverflow.com/questions/44778902
复制相似问题