Uber API GET / ratings / price response surge_multiplier has disappeared

Today, I found that the get / ratings / endpoint prices have a change, surge_multiplier has disappeared, can I say the price has been fixed, there are no more surges?

+1
source share
1 answer

The care is based on the specific location and configuration of the product, so if you try to fulfill the following request, for example:

https://sandbox-api.uber.com//v1.2/estimates/price?start_latitude=-33.865535736083984&start_longitude=151.1958770751953&end_latitude=-33.88345718383789&end_longitude=151.0906982421875

"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" }, 

If you try it elsewhere:

start_latitude = 37.7752315 & start_longitude = -122.4118075 & end_latitude = 37.7752415 & end_longitude = -122.518075

You will receive a response without the "surge_multiplier" parameter:

 { "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" }, 

For more information on raising, please read the documetation.

EDIT done 02/15/2012:

If you use v1.2, the response request that we receive is based on the configuration of the product. If the product used in the pricing request is configured to have "upfront_fare_enabled": true, then we will get one fare_id instead of the pricing. Thus, this is expected, as in v1.2 with upfront_fare_enabled: true there will never be surge information (since you get the real tariff + fare_id).

Please check the following sentence from our documentation on the endpoint "POST / v1.2 / requests / estimate":

You must use this endpoint to get an advance fare before requesting a trip. For some products, up-front rates are not included, so you can use this endpoint to determine if a pricing policy applies to the product / location. Do this before trying to make a travel request in such a way that you can forestall the user to confirm the surge by sending them surge_confirmation_href, indicated in the answer. This endpoint will either return an upfront rate (in the fare key) or a rating range (in the pricing key) depending on the configuration of the product.

So the answer you get depends on the configuration of the product: "upfront_fare_enabled". If there is a preliminary tariff setting (upfront_fare_enabled = true), then the response will not have "surge_confirmation_href", and the response type will be one "tariff": {} answer is an example of this below:

 { "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 } 

As you can see, there are no "surge_confirmation_href" available.

If your product has "upfront_fare_enabled": false, you will receive an evaluation answer using surge_confirmation_id and surge_confirmation_href, as shown below:

 { "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 } 

And finally, if you upgrade the product to have "surge_multiplier"> 1, and the product has "upfront_fare_enabled = true", you will get the answer "travel" - but you will not know what the surge is in place - until you ask for a ride, In this case, you will receive a response with: "status": 409 and "title": "Currently, a reassignment pricing policy is in effect for this product." and "surge_confirmation", which contains "href": " https://sandbox-api.uber.com/surge-confirmations/ride_request_id ". Therefore, in order to fulfill your travel request, you need to redirect the user to this URL, and the user needs to confirm the surge. After that, you can create a new travel request.

resposne →

 { "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." } ] } 
+1
source

Source: https://habr.com/ru/post/1275348/


All Articles