当我们要求价格/时间估算时,Uber API是否提供“优步池”乘坐类型?此外,当乘车即将到来时,我们是否可以访问电话号码以便给司机发短信?
这不是API问题,因为它是我们很多用户想要的功能问题/请求。我通过电子邮件联系了优步的支持团队,他们告诉我在StackOverflow中发布任何相关的API ...
答案 0 :(得分:2)
Does the Uber API offered "Uber Pool" ride type when we requests price / time estimates?
根据GET /v1/products API端点文档:
Some Products, such as experiments or promotions such as UberPOOL and UberFRESH, will not be returned by this endpoint.
因此,UberPOOL产品无法通过优步API获得。
Also, when a ride is coming, do we have access to a phone number in order to text the driver?
使用POST /v1/requests API端点发出乘车请求后,乘车将进入的第一个状态是处理状态,您将收到类似于:
Status-Code: 202 OK
{
"request_id": "852b8fdd-4369-4659-9628-e122662ad257",
"status": "processing",
"vehicle": null,
"driver": null,
"location": null,
"eta": 5,
"surge_multiplier": null
}
正如您所看到的,您无法访问此状态下的任何驱动程序信息。
然后,根据life cycle of a request,一旦驱动程序接受您的请求,请求流就需要从处理状态转移到接受状态。
接受状态是您可以通过调用GET /v1/requests/current或GET /v1/requests/{request_id} API端点来访问驱动程序详细信息的第一个状态。
您可以通过webhook或polling at a 3-5 seconds interval上述某个Uber API端点上的回调来了解状态何时更改,以获取当前状态。
在发出上述HTTP请求之后收到的HTTP响应如下所示:
{
"request_id":"852b8fdd-4369-4659-9628-e122662ad257",
"status":"accepted",
"location":{
"latitude":37.7886532015,
"longitude":-122.3961987534,
"bearing":135
},
"pickup":{
"latitude":37.7872486012,
"longitude":-122.4026315287,
"eta":5
},
"destination":{
"latitude":37.7766874,
"longitude":-122.394857,
"eta":19
},
"driver": {
"phone_number": "(555)555-5555",
"rating": 5,
"picture_url": "https:\/\/d1w2poirtb3as9.cloudfront.net\/img.jpeg",
"name": "Bob"
},
"vehicle":{
"make": "Bugatti",
"model": "Veyron",
"license_plate": "I<3Uber",
"picture_url": "https:\/\/d1w2poirtb3as9.cloudfront.net\/car.jpeg"
},
"surge_multiplier":1.0,
"eta": 5
}
此时您可以访问驱动程序的电话号码,您可以用它来拨打电话或发短信。