Uber API "Get Products" endpoint returns different data than app. - uber-api

This is a question for the UBER dev team. I'm calling to the "Get Products" endpoint and I'm returning products for a list of cities. In some of the cities, the API returns that there are no products in the latitude/longitude pair but when I use the app I am able to request a ride in that city.
Ex, Meridian, MS:
{ lat: 32.3643098, lng: -88.703656 } { products: [],
rate_limit: { limit: '2000',
remaining: '1979',
reset: 2017-10-27T17:00:00.000Z } }
In app:
Meridian
Is this intentional, or is this something that we can expect to be fixed in future releases?
Thanks!

I was not able to reproduce. Calling GET for https://api.uber.com/v1.2/products?latitude=32.3643098&longitude=-88.703656 (the lat / long you specified) returns a product:

My error was that I was parsing and therefore rounding the latitudes and longitudes before I used them in the call to the endpoint, which gave me incorrect latitudes/longitudes to use.

Related

Why am i receiving different results from the HERE Routing API and the HERE Maps Website?

We are using the Routing API V8. When I call the API. I am getting a return result of
2021-03-03T18:09:52+10:00 But from the maps website. I am getting a result of https://wego.here.com/directions/mix/6-Kyabra-St,-Newstead-QLD-4006,-Australia:-27.45264,153.04265/35-Hercules-St,-Hamilton-QLD-4007,-Australia:-27.43945,153.06973?map=-27.44536,153.05502,15,normal It says a 12 minute travel time.
Here is my API Call: https://router.hereapi.com/v8/routes?transportMode=car&origin=-27.452630,153.042350&destination=-27.439750,153.069630&departureTime=2021-03-03T08:00:00Z&apiKey=
Here is the full response from the API:
{"routes":[{"id":"3ff8ffc9-1f66-4b47-9ec0-a59cf2268348","sections":[{"id":"e4154bf2-2052-4846-b46c-5cfe4b4cfc01","type":"vehicle","departure":{"time":"2021-03-03T18:00:00+10:00","place":{"type":"place","location":{"lat":-27.4526753,"lng":153.0426484},"originalLocation":{"lat":-27.45263,"lng":153.0423499}}},"arrival":{"time":"2021-03-03T18:09:52+10:00","place":{"type":"place","location":{"lat":-27.4396845,"lng":153.0693942},"originalLocation":{"lat":-27.4397501,"lng":153.06963}}},"transport":{"mode":"car"}}]}]}
Based on HERE routing API v8 documentation, when I removed Z from end of departureTime parameter in order to assume time is local to the origin, the time is shown correctly:
....
departure": {
"time": "2021-03-03T08:00:00+10:00",
....
arrival": {
"time": "2021-03-03T08:10:20+10:00",
...

REST API - GET Request filter by Ids

Let's say I have an index endpoint to list units
GET /projects/1/units/?id[]=1,2,3
and units with ids(1,2) belongs to project with id (1) but unit with id (3) doesn't belong to this project
What should be the proper response for this case, please note it's GET collection endpoint.
Response should be 200 with list of available units or 400 Bad Request because the unit with id=3 doesn't belong to the project?
Thanks
REST doesn't say anything about searching or the ability to retrieve multiple things in one API call. Remember that REST APIs should use hypermedia to indicate their state. This means that you can have an API that lists the units for a particular project as links.
GET /projects/1/units
{
'self': {...}
'links': [
{
'rel': 'unit',
'href': '/projects/1/unit/1',
'type': 'project.unit'
},
{
'rel': 'unit',
'href': '/projects/1/unit/2',
'type': 'project.unit'
}
]
}
Note that if unit 3 doesn't exist as part of project 1 then you should be returning a http status 404.

Custom Dimensions Not Reporting Through to Google Analytics API V4

I am attempting to pass information collected as, "custom dimensions," from Google Tag Manager through Google Analytics and then extract them out via the Google Analytics V4 API.
I have set up four of the fundamental custom dimensions suggested by Simo Ahava in this article.
My variable setup looks like the following:
variable setup
Essentially, I have been able to successfully pass through userID_dimension, hittimestamp_dimension, clientid_dimension and sessionid_dimension to the Google Analytics dashboard, but for some reason I am not able to extract out the hittimestamp_dimension through the API.
Here's what I am able to see on the dashboard:
Google Analytics Dashboard
As far as the API itself, I am using the HelloAnalytics.py python version supplied by Google, and I am able to extract out all of the above information, minus the timestamps dimensions on the right hand side of each.
I'm storing the timestamp information in dimension2, but upon making the below call (again, using API V4) I get blank...nothing.
analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2017-10-05', 'endDate': '2017-10-06'}],
'samplingLevel': 'LARGE',
'dimensions': [{'name': 'ga:dimension4'},{'name': 'ga:dimension2'}]
}]
}
).execute()
Upon making this call, one would expect that the above would report out dimensions similar to what the Google Analytics dashboard would show. E.g. one would think that the dashboard itself is using the API. However what prints out is blank. All other custom dimensions print out as expected.
If I try to call the above function on just dimension2 itself with no other dimension, it is also blank.
Is there something special one has to do in order to extract hit-scoped variables within the API? Or does the API just not allow hit-scoped variables to pass through?
thanks,
You forgot to add a 'metrics' field to your request, it is required as per documentation
Source: Reporting API v4 - Method: reports.batchGet
The metrics requested. Requests must specify at least one metric. Requests can have a total of 10 metrics.
The below modified request should work:
analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2017-10-05', 'endDate': '2017-10-06'}],
'samplingLevel': 'LARGE',
'dimensions': [{'name': 'ga:dimension4'},{'name': 'ga:dimension2'}],
'metrics': [{'expression': 'ga:sessions'}]
}]
}
).execute()

Mapquest route matrix response

Hi I am using mapquest api to show the distance from source to destination in app
Problem:
I am sending below request to mapquest to get the distance
{ "locations":[ "40.2336,-111.6475", "33.621227,-111.917229","30.688181,76.706238"],
"options":{ "allToAll":true, "unit":"k", "doReverseGeocode":false,"manyToOne":true } }
Now in this case distance can be calculated from first lat long to second lat long as both are US based address but distance cannot be calculated between first and third location as third one is Indian location .
Now the response I am getting is
{"route":{"routeError":{"message":"","errorCode":0}},"info":{"copyright":
{"text":"© 2015 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif",
"imageAltText":"© 2015 MapQuest, Inc."},"statuscode":400,
"messages":["We are unable to route with the given locations."]}}
Which I suppose is wrong as distance between first two places should be returned .
Please suggest what can be done for this ?
Currently the matrix fails if any of the legs fails. Making this return any successful legs is on the team's backlog.
The reason for the error is that your locations are invalid. I ran it with the exact POST body you had, and got error 402. Looking at the MapQuest Directions API Status Codes, this is an invalid location. This makes sense, considering the coordinates include two in the US and one in India. This, AFAIK, is only a driving API, hence why overseas locations are invalid.
Another point unrelated to the main problem: your request is semantically invalid. You specify both allToAll and manyToOne as true, which is invalid. The API will ignore your manyToOne as a result, so make sure you are requesting exactly what you want.

Bing Maps REST Service

I am sending a request to Bing Maps REST service to get the location information such as coordinates etc, I entered this request (http://dev.virtualearth.net/REST/v1/Locations/query=rsa/gauteng/2001/johannesburg/melville?o=xml&key="mykey") in my web browser (as a test) and it returns the wrong location information.
The returned xml suggests that I'm in the states somewhere in NY.
Can anyone help me understand why this is?
I have read Microsoft's documentation on the web service and I'm following the proper structure to construct a request. I have Googled in a quest of getting a solution but no luck
You're not issuing the request correctly. Bing provides two methods: structured query and non-structured. You're mixing both.
Structured ("REST" like):
http://dev.virtualearth.net/REST/v1/Locations/CA/BC/V6G/Vancouver/Stanley%20Park%20Causeway?key=BingMapsKey
Non-structured (with query-string):
http://dev.virtualearth.net/REST/v1/Locations?locality=London&postalCode=SW1A&key=BingMapsKey
As specified on the reference page (http://msdn.microsoft.com/en-us/library/ff701714.aspx) a request similar to yours would need to be done like this:
http://dev.virtualearth.net/REST/v1/Locations?countryRegion={country}&adminDistrict={district}&locality={locality}&key={key}
Also, you should use the 2-letter ISO code. Thus, South-Africa would be "ZA".
Your complete request will be:
http://dev.virtualearth.net/REST/v1/Locations?countryRegion=za&adminDistrict=johannesburg&locality=melville&key=key
It returns something like this:
address: {
adminDistrict: "Gauteng",
adminDistrict2: "Johannesburg",
countryRegion: "South Africa",
formattedAddress: "Melville, South Africa",
locality: "Melville"
},
confidence: "High",
entityType: "Neighborhood",
geocodePoints: [{
type: "Point",
coordinates: [
-26.17535972595215,
28.008920669555664
],
calculationMethod: "Rooftop",
usageTypes: ["Display"]
}]