Why do I get two UberPool products in the APIs? - uber-api

I get two UberPool products in the following APIs:
api.uber.com/v1/estimates/time
api.uber.com/v1/estimates/price
api.uber.com/v1/products
Why do I get two products? How are they different?
Example response:
Url:
api.uber.com/v1/estimates/price
Response:
{
"prices": [
{
"localized_display_name": "uberPOOL",
"high_estimate": 33,
"minimum": null,
"duration": 0,
"estimate": "₹32.50",
"distance": 0,
"display_name": "uberPOOL",
"product_id": "e0178e76-b13f-4ae6-9f72-6acadbb450c5",
"low_estimate": 32,
"surge_multiplier": 1,
"currency_code": "INR"
},
{
"localized_display_name": "uberPOOL",
"high_estimate": 51,
"minimum": null,
"duration": 0,
"estimate": "Unavailable",
"distance": 0,
"display_name": "uberPOOL",
"product_id": "f855a84b-a0ec-40d8-a455-fb0d2db58089",
"low_estimate": 50,
"surge_multiplier": 1,
"currency_code": "INR"
},
{
"localized_display_name": "uberGO",
"high_estimate": 50,
"minimum": 50,
"duration": 0,
"estimate": "₹50",
"distance": 0,
"display_name": "uberGO",
"product_id": "18ba4578-b11b-49a6-a992-a132f540b027",
"low_estimate": 50,
"surge_multiplier": 1,
"currency_code": "INR"
}
....
]
}

Thank you for the report. This is a known issue and we're working on a fix. In the meantime, you can use either uberPOOL product that is surfaced.

TL;DR Uber sometimes offers many products in a given location, and they're all returned from those two endpoints.
To expound on that... according to the docs, this is normal:
The Products endpoint returns information about the Uber products
offered at a given location. The response includes the display name
and other details about each product, and lists the products in the
proper display order.
Some products, such as uberEATS, are not returned by this endpoint.
We'll soon be making uberPOOL available in this endpoint.
Particularly: We'll soon be making uberPOOL available in this endpoint. It seems that time has come.
The same goes for the estimates endpoint.
The Price Estimates endpoint returns an estimated price range for each
product offered at a given location.
How are they different?
Uber offers different types of services in different countries.
UberGo is a cheaper version of UberX that seems to be specific to India.
UberPool is fairly straight forward in that it's a carpooling service offered to those who wish to split the fare with others that are heading in the same destination.
Since services vary by location, it's best to research them individually when constructing a service that's consuming the Uber API.

Related

Documentation on HERE api responses

I am using the Routing API v8 to get instructions on how to get from one point to the other. I want to provide the user with a time and distance estimate.
Still trying to figure out how to get the distance, but for the time, I have been adding the "duration" fields but the result is very different from what I experience in that route. Additionally, there are also other fields in the response that I am not very sure about their meaning. For example, in the below response:
...
"actions": [
{
"action": "depart",
"duration": 133,
"instruction": "Head northwest on Flint Close. Go for 124 m.",
"offset": 0
},
{
"action": "turn",
"duration": 168,
"instruction": "Turn right onto Vicarage Lane. Go for 158 m.",
"offset": 3,
"direction": "right",
"severity": "quite"
},
{
"action": "turn",
"duration": 234,
"instruction": "Turn left onto Deanery Road. Go for 233 m.",
"offset": 9,
"direction": "left",
"severity": "quite"
},
...
What does the offset property mean? Is there somewhere where I can find more information on these?
Regarding to the properties, you can find them in the OpenAPI specifition document here
E.g., for "offset", it is a property for a few actions (like TurnAction in the spec),
offset:
description: Offset of a coordinate in the section's polyline.
type: integer
Regarding to distance, it should be in the summary section.
For a route which duration is not expected, we will need a deeper analysis. Please provide the exact API call you used in the comment, and we can run a check on that.
Also, please feel free to try our refclient here for a quick feeling of our Routing APIs and varies parameters.

Kairos enroll API returns confidence in the response. What does it mean?

I am exploring Kairos Facial Recognition APIs. The API /enroll is used for uploading an image to Kairos for a subject_id. I noticed that the response of enroll API contains a confidence score. The image is treated as a new image. What does this confidence mean? When you verify an image, in that case the confidence score is important. But while uploading an image, why does the API return a confidence?
I assume, the API compares the image to the images uploaded before for that subject_id and returns the confidence. Is this the case or is it something else?
API Documentation: API_docs.
Here is a sample response for reference:
{
"face_id": "f2f0f8de43e545f8aff",
"images": [
{
"attributes": {
"age": 40,
"asian": 0.13225,
"black": 0.00103,
"gender": {
"femaleConfidence": 0.00028,
"maleConfidence": 0.99972,
"type": "M"
},
"glasses": "None",
"hispanic": 0.09578,
"lips": "Together",
"other": 0.27899,
"white": 0.49195
},
"transaction": {
"confidence": 0.99932,
"eyeDistance": 30,
"face_id": "f2f0f8de43e545f8aff",
"gallery_name": "ps-recognize",
"height": 70,
"image_id": 1,
"pitch": -14,
"quality": 0.10107,
"roll": -4,
"status": "success",
"subject_id": "vinod-khanna.&**#~`%$#_=+/",
"timestamp": "1526029231708",
"topLeftX": 124,
"topLeftY": 42,
"width": 70,
"yaw": 1
}
}
]
}
Yes, this isn't clear from the documentation.
For /recognize and /verify the confidence % represents how similar the face sent in with the request is to the the face being compared against.
For /detect and /enroll the confidence represents how confident the engine is that it found a face. Usually you will see 98-99 percent range for those values.
Disclosure: Kairos.com CTO

Uber API /v1/estimates/price responds No authentication provided

In my programe, I need to use the Uber api:
/v1/estimates/price
,so I test it in chrome by postman, but it responses No authentication provided.
I search the stackoverflow and find this page "Uber API /v1/estimates/time responds No authentication provided".
According to the last answer from faarwa which guide the asker get the complete info, I think I would get the complete info like the asker, but in fact,I failed,I got the same response.
This is my url:
https://api.uber.com.cn/v1/estimates/price?server_token=MyTooken&start_latitude=31.993750705445024&start_longitude=118.71421140272062&end_latitude=32.046405144489704&end_longitude=118.80070636431914
the response is:
{
"message": "No authentication provided.",
"code": "unauthorized" }
BTW: I tested the api in China.
I checked your curl command and it looks great. In fact, I get a response for the exact command with my server_token:
curl "https://api.uber.com.cn/v1/estimates/price?server_token=<SERVER_TOKEN>&start_latitude=31.993750705445024&start_longitude=118.71421140272062&end_latitude=32.046405144489704&end_longitude=118.80070636431914" | jq
My response is:
{
"prices": [
{
"localized_display_name": "People's Uber +",
"distance": 7.72,
"display_name": "People's Uber +",
"product_id": "...",
"high_estimate": 34,
"surge_multiplier": 1,
"minimum": 7,
"low_estimate": 24,
"duration": 2160,
"estimate": "CN¥24-34",
"currency_code": "CNY"
},
{
"localized_display_name": "Uber Sedan",
"distance": 7.72,
"display_name": "Uber Sedan",
"product_id": "...",
"high_estimate": 111,
"surge_multiplier": 1,
"minimum": 20,
"low_estimate": 86,
"duration": 2160,
"estimate": "CN¥86-111",
"currency_code": "CNY"
}
]
}
Here's my assumption why your query doesn't work: You are trying to use Uber in China (based on the URL and location), which requires you to use an Uber app for China as well. Could you please validate if your app shows up in the Uber Dashboard China? For more information, please check out the China Guide in our developer docs.
Just to be clear - the reason it is not working is the app you created was not created in the Uber China Developer Dashboard. If you use credentials from a newly created app it should work as expected.

Possible for Uber to add car count to /v1/products

I know Uber doesn't want to allow car coordinates for all available cars (not fully certain why though), however, could Uber please at least add the total available cars at any given request time, something like the following:
"products": [
{
"capacity": 2,
**"available": 7,** // add available cars available (or similar)
"description": "Ride for less with uberPOOL",
"price_details": {
"distance_unit": "mile",
"cost_per_minute": 0.26,
"service_fees": [
{
"fee": 1.0,
"name": "Safe Rides Fee"
}
],
"minimum": 5.0,
"cost_per_distance": 1.3,
"base": 2.2,
"cancellation_fee": 5.0,
"currency_code": "USD"
},
"image": "http://d1a3f4spazzrp4.cloudfront.net/car.jpg",
"display_name": "POOL",
"product_id": "26546650-e557-4a7b-86e7-6a3942445247",
"shared": true,
},
Showing that a car is available is great, but what if its only one car and someone else snags it before the user viewing it is able to do so? If it shows "Cars Available: 5" - then the user knows there is a pretty good chance they will get a driver close to the allotted ETA already provided.

Best Practices in Retrieving Related Data in a REST API

So I have a REST API in which I Have a resource in which other resources are linked to (related models, in programming point of view).
So how I am doing it right now is that whenever I request for a resource, related resources are referenced via URLs ('/related_data/related_data_id/').
However, I worry that, let's say there are 5 related resources to the one I'm retrieving, is that I would perform 5 GET requests. I am writing an iPhone client and I'm wondering if this is how to properly do it using REST (that I'm returning URLs). A sample JSON response is this:
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 2
},
"objects": [
{
"away_team": "/api/team/3/",
"country": "/api/country/1/",
"event_date": "2011-08-16",
"event_time": "06:00:00",
"event_timezone": "GMT",
"home_team": "/api/team/4/",
"id": "1",
"level": "/api/level/4/",
"resource_uri": "/api/event/1/",
"tournament": "/api/tournament/1/"
},
{
"away_team": "/api/team/4/",
"country": "/api/country/1/",
"event_date": "2011-09-29",
"event_time": "12:00:00",
"event_timezone": "UTC",
"home_team": "/api/team/3/",
"id": "2",
"level": "/api/level/1/",
"resource_uri": "/api/event/2/",
"tournament": "/api/tournament/6/"
}
]
}
Is this a proper way of doing it in REST, considering that "each URI must map to a resource" and all those things?
I am using Django and django-tastypie
Thanks in advance!
Yes; that is proper if the related resources are updated independently. REST architectures depend on caching for performance, and therefore work best with resources which act as atomic entities (see more here). That way, you can update resource B and have its representation be fresh without having to update resource A. See this SO comment for more design details.