【发布时间】:2019-07-18 16:43:39
【问题描述】:
我正在试用 uber 乘车请求 API。能够在沙盒和产品中获取产品、票价估算。但是乘车请求正在返回 404 页面未找到。 得到票价估算后,我立即提出乘车请求以确保票价估算不会过期。我正在邮递员中对此进行测试,并给出了邮递员代码
在沙盒和 prod 中都尝试过并返回相同的结果。 尝试在乘车请求中添加 product_id 并将其保持为可选
票价估计码
curl -X POST \
https://api.uber.com/v1.2/requests/estimate \
-H 'Accept: */*' \
-H 'Authorization: Bearer token-xyzzabcd' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: api.uber.com' \
-H 'User-Agent: PostmanRuntime/7.15.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'content-length: 226' \
-H 'cookie: marketing_vistor_id=59526eba-b6e3-4024-a8a9-0b9f1c88eb7b' \
-b marketing_vistor_id=59526eba-b6e3-4024-a8a9-0b9f1c88eb7b \
-d '{
"start_latitude": 18.660952,
"start_longitude": 73.828433,
"end_latitude": 18.562113,
"end_longitude": 73.8042427,
"product_id": "3d67403a-afdc-41a1-9ea9-df68a3f4a835"
}'
得到以下对票价估算的响应
{
"fare": {
"breakdown": [
{
"type": "base_fare",
"name": "Base Fare",
"value": 200.99
}
],
"value": 200.99,
"fare_id": "df4b3a6da7cecd7d93bfd08aef2f096cb18b2374c87a97dd639ae54fe4088045",
"expires_at": 1561107159,
"display": "₹200.99",
"currency_code": "INR"
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 1800,
"distance_estimate": 10.59
},
"pickup_estimate": 6
}
乘车请求
curl -X POST \
https://api.uber.com/v1.2/requests/ \
-H 'Accept: */*' \
-H 'Authorization: Bearer tokenabcdxyz' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: api.uber.com' \
-H 'User-Agent: PostmanRuntime/7.15.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'content-length: 306' \
-H 'cookie: marketing_vistor_id=59526eba-b6e3-4024-a8a9-0b9f1c88eb7b' \
-b marketing_vistor_id=59526eba-b6e3-4024-a8a9-0b9f1c88eb7b \
-d '{
"start_latitude": 18.660952,
"start_longitude": 73.828433,
"end_latitude": 18.562113,
"end_longitude": 73.8042427,
"product_id": "3d67403a-afdc-41a1-9ea9-df68a3f4a835",
"fair_id": "df4b3a6da7cecd7d93bfd08aef2f096cb18b2374c87a97dd639ae54fe4088045"
}'
得到以下回应
404 page not found
【问题讨论】:
标签: uber-api