预订骑尤伯杯API

问题描述 投票:1回答:1

当我仰望的产品,我可以得到具有product_id作为真正的upfront_fare_enabled

然后我得到了fare_id

然而,当我使用fare_id预订一坐,我总是得到下面的错误;

{ “元”:{}, “错误”:[{ “状态”:422, “代码”: “upfront_fare_required”, “标题”: “一个有效fare_id需要请求跳闸此产品”}]}

同时,明确指出product_idupfront_fare_enabled是真实的。

如果我仰望该产品是它只是说,

"{"fare":{"breakdown":[{"type":"base_fare","name":"Base Fare","value":10.4}],"value":10.4"}"}"

一无所知upfront_fare_enabled

我已经交叉检查;该product_id是正确的。

我在做什么错了,我该如何解决?

uber-api
1个回答
1
投票

这是覆盖在API文档https://developer.uber.com/docs/riders/ride-requests/tutorials/api/curl

尤伯杯API可以让你请求的尤伯杯产品的车手。鉴于你知道骑手的位置,在那里他们想去的地方,和尤伯杯产品,他们想要的,你可以要求他们用几个简单的API端点一程。

在产品端点GET /产品,产品有upfront_fare_enabled字段设置为true。

使用要求估计端点POST /请求/估计用的product_id获得fare_id。所述fare_id用于设置一个前期费用和到达时间跳闸。该fare_id两分钟后到期。如果fare_id过期或无效,则返回422错误。

请求使用与在先前步骤中返回的fare_id请求端点POST /请求一程。

请参阅API文档在这里的两个API

https://developer.uber.com/docs/riders/references/api/v1.2/requests-estimate-post#example-response-with-surge-pricing

https://developer.uber.com/docs/riders/references/api/v1.2/requests-post#post-parameters

© www.soinside.com 2019 - 2024. All rights reserved.