【发布时间】:2018-03-06 05:47:46
【问题描述】:
今天发现GET/estimates/price端点有变化,surge_multiplier消失了,也就是说,价格已经固定,不再暴涨?
【问题讨论】:
标签: uber-api
今天发现GET/estimates/price端点有变化,surge_multiplier消失了,也就是说,价格已经固定,不再暴涨?
【问题讨论】:
标签: uber-api
Surging 基于特定位置和产品设置 - 因此,如果您尝试以下请求,例如:
"prices": [
{
"localized_display_name": "uberX",
"distance": 7.76,
"display_name": "uberX",
"product_id": "2d1d002b-d4d0-4411-98e1-673b244878b2",
"high_estimate": 35,
"surge_multiplier": 1,
"minimum": 9,
"low_estimate": 26,
"duration": 1260,
"estimate": "A$26-35",
"currency_code": "AUD"
},
如果你尝试不同的位置:
start_latitude=37.7752315&start_longitude=-122.418075&end_latitude=37.7752415&end_longitude=-122.518075
你会得到没有'surge_multiplier'参数的响应:
{
"localized_display_name": "uberXL",
"distance": 6.62,
"display_name": "uberXL",
"product_id": "821415d8-3bd5-4e27-9604-194e4359a449",
"high_estimate": 28,
"low_estimate": 22,
"duration": 1380,
"estimate": "$22-28",
"currency_code": "USD"
},
更多关于澎湃的信息请阅读我们的documetation
编辑于 2018 年 2 月 15 日完成:
如果您使用的是 v1.2 请求 - 我们得到的响应是基于产品设置的。如果估算请求中使用的产品配置为“upfront_fare_enabled”:true,那么我们将获得一个 fare_id - 而不是估算。因此,这是在 v1.2 中使用 upfront_fare_enabled: true 时所预期的,永远不会有激增信息(因为您获得的是真实票价 + fare_id)。
请查看我们关于“POST /v1.2/requests/estimate”端点的文档中的以下句子:
您应该在请求之前使用此端点获取预付费用 载一程。在某些产品中,未启用预付票价,因此您可以使用 这个端点来确定激增定价是否对 产品/位置。在尝试发出乘车请求之前执行此操作,以便 您可以先发制人地让用户确认激增,方法是将他们发送到 响应中提供的 spray_confirmation_href。这个端点 将返回前期票价(在票价键中)或范围 估计(在估计键中)取决于配置 产品。
因此,您得到的响应具体取决于产品配置:“upfront_fare_enabled”字段。如果有预付票价设置 (upfront_fare_enabled = true),则响应中将没有可用的“surge_confirmation_href” - 响应类型将是一个“票价”:{} 响应 - 示例如下:
{
"fare": {
"value": 5.73,
"fare_id": "d30e732b8bba22c9cdc10513ee86380087cb4a6f89e37ad21ba2a39f3a1ba960",
"expires_at": 1476953293,
"display": "$5.73",
"currency_code": "USD",
"breakdown": [
{
"type": "promotion",
"value": -2.00,
"name": "Promotion"
},
{
"type": "base_fare",
"notice": "Fares are slightly higher due to increased demand",
"value": 7.73,
"name": "Base Fare"
}
]
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 540,
"distance_estimate": 2.39
},
"pickup_estimate": 2
}
如您所见,没有可用的“surge_confirmation_href”。
如果您的产品具有 "upfront_fare_enabled": false,您将获得带有surge_confirmation_id 和surge_confirmation_href 的估计响应,如下所示:
{
"estimate": {
"surge_confirmation_href": "https:\/\/api.uber.com\/v1\/surge-confirmations\/7d604f5e",
"high_estimate": 11,
"surge_confirmation_id": "7d604f5e",
"minimum": 5,
"low_estimate": 8,
"fare_breakdown": [
{
"low_amount": 1.25,
"high_amount": 1.25,
"display_amount": "1.25",
"display_name": "Base Fare"
},
{
"low_amount": 1.92,
"high_amount": 2.57,
"display_amount": "1.92-2.57",
"display_name": "Distance"
},
{
"low_amount": 2.50,
"high_amount": 3.50,
"display_amount": "2.50-3.50",
"display_name": "Surge x1.5"
},
{
"low_amount": 1.25,
"high_amount": 1.25,
"display_amount": "1.25",
"display_name": "Booking Fee"
},
{
"low_amount": 1.36,
"high_amount": 1.81,
"display_amount": "1.36-1.81",
"display_name": "Time"
}
],
"surge_multiplier": 1.5,
"display": "$8-11",
"currency_code": "USD"
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 480,
"distance_estimate": 1.95
},
"pickup_estimate": 2
}
最后,如果您将产品更新为“surge_multiplier”> 1 并且产品具有“upfront_fare_enabled = true”,您将收到“票价”响应 - 但您不会知道 surge 已经到位 - 直到您提出乘车请求.在这种情况下,您将收到以下响应:“status”:409 和“title”:“此产品目前正在实施激增定价。”和包含“href”的“surge_confirmation”信息:“https://sandbox-api.uber.com/surge-confirmations/ride_request_id”。因此,为了完成您的乘车请求 - 您需要将用户重定向到该 URL - 并且用户需要确认激增。之后,您将能够创建新的乘车请求。
回复->
{
"meta": {
"surge_confirmation": {
"href": "https://sandbox-api.uber.com/surge-confirmations/48165d0e-f2f4-457d-98d0-058a31b15cd7",
"expires_at": 1510684778,
"multiplier": 1.2,
"surge_confirmation_id": "48165d0e-f2f4-457d-98d0-058a31b15cd7"
}
},
"errors": [
{
"status": 409,
"code": "surge",
"title": "Surge pricing is currently in effect for this product."
}
]
}
【讨论】:
v1.2 不会为 UberX 返回 surge_multipliter,即使激增处于活动状态。而如果我使用 v1.0 它会返回正确的结果。