I want to use Google Transit API in Android application. But I am getting data from service. I used the following parameters:
http://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&sensor=false&departure_time=1343605500&mode=transit
I always get this response:
{
"routes" : [],
"status" : "ZERO_RESULTS"
}
I think I am passing something wrong in any of parameters used in above URL, maybe departure_time is wrong?
Can anyone tell what should pass to parameters?
Can anyone help me to find out URL with such parameters which return value ?
You just have to set departure_time parameter to some time in future (like several days). From here:
When requesting transit directions, be sure to specify either a
departure_time or arrival_time. Note that in this example the
departure time is specified as July 30, 2012 at 09:45 am. Update the
parameter to a point in the future before submitting the request.
Try http://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&sensor=false&departure_time=1350472557&mode=transit, it works.
Related
I'm trying to run a query for a tag - https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN, but get an error
{"pagination": {"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"}, "meta": {"code": 200}, "data": []}
Well it seems that, this end-point returns only the token owner's post on this tag only. So from now on you cannot get the public hastag feeds of all users. Sandbox or Live doesnot matter I guess.
Believe this is down to the sandbox changes where the data returned is only for upto 20 sandbox users rather than true public_content.
I'm trying this also and seeing the same so trying to go through review to see if that fixes things up.
I was using an HTTP GET action on Tasker on Android 4.4 for quite some time now in order to get my future google calendar events. This task no longer works due to Google shutting down the v2 API.
For the API v3 an authentification is needed. I tried to get a client key from the developer console. I created a new project and activated the calendar API for it. I then created a new client ID and do have this client ID with its corresponding key. How can I get a list of my (future) events from my personal Google calendar via HTTP GET and this authentification information? I'm trying to use:
https://www.googleapis.com/calendar/v3/calendars/my_calendar_ID/events?singleEvents=true&key=my_client_key
This returns an error:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "keyInvalid",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
What am I doing wrong? Thanks in advance!
Usually this error is thrown when the key used in the request is invalid. In the request you have to use the public key not the client secret(when you want to send the API key). Here is the link for the documentation on how to get the public key to your application.
Also,here is the link for documentation about the HTTP request for events get request.
To anyone trying to achieve the same and who's not in the need to use API v3 at any cost:
There is still an option to get future events with a request similar to API v2. Therefore, use the private XML-code from the calendar settings and add the parameters you need. E.g.:
HTTP GET http://www.google.com/calendar/feeds/your_email/private-validation/basic?futureevents=true&max-results=1&singleevents=true&orderby=starttime&sortorder=ascending
I could not find any up-to-date documentation from Google about this but it's working. The main difference to API v2 is the "/basic?" at the end instead of the old "/full?". Otherwise most parameters seem to work fine.
futureevents=true - only shows future events
max-results=integer - only show integer number of results
singleevents=true - handly reoccuring events as single events
orderby=starttime - sort results by their starting time instead of last update
sortorder=ascending - well, sort order
"printpretty" seems not to be supported anymore. Also, the timestamp has a different look now. But still, all the information needed is included.
The example above shows the request for the next event in the calendar. This may be extended to multiple events (e.g. max-results=5). The other parameters are needed to show up the next events as expected instead of some seemingly random events. The problem with this method is of course that your private adress is used in the request which may be insecure in comparison to API v3.
I am in the process of making an android application with a location field so am using Google Places Autocomplete in order to assist the user. Once they select a choice from the list, I am then getting the place_id from the response and using that to get the full address and coordinates. However, I am seeing inconsistent results. For example, if I have an address typed in I get the following in the response:
"place_id" : "ChIJhV00Saykj4ARf5pLLQUgXh8",
"reference" : "CkQ4AAAA6Oz4yvX3mdvSp_NuluEW-aMS5Kg6j0gNDxjidPUbnqsNrm17-Am4C8HwIBMfNXK20UvsrZt7MnJ1MeV3-N6kqxIQrIQn113f7ksZNBoX2NBVahoU4p6yZwFFSlTP5jZUXib5CO7uO5k",
If I use that place_id for a details request, I am missing the street_number, which was included in the previous response. If I use the reference in the details request, then I get the correct location, with the street_number along with a different place_id.
"place_id" : "ChIJm5jeVKykj4ARICvBIsIA2MI",
After reading the docs, they said reference will be depreciated and I should use place_id but it is not working properly. Does anyone know why or what is your solution for a place details request?
i am using foursqure functionality in my application,one week ago my application was working with foursqure and i was getting sucessful login ,but now when i am using it again..,its giving me following error.
"meta":{
"code":410,
"errorType":"param_error",
"errorDetail":"The Foursquare API no longer supports requests that do not pass in a version parameter. For more details see https:\/\/developer.foursquare.com\/overview\/versioning"
},
"response":{
}
}
why i am getting this error.,it was working before few days but its not working now,i am unable to understand where i am doing wrong ,please help me for this,thankyou.
Your request is probably missing a parameter.
Foursquare has changed it's api as of January 28, 2014.
"Requests that do not include a v parameter will be rejected."
You will need to add a v parameter which will be a date that represents the "version" of the API you expect from Foursquare.
v=YYYYMMDD
Clients that wish to be robust against changes should always pass v=DATEVERIFIED (in the YYYYMMDD format) and watch for any deprecated responses coming back from the server.
For more information visit:
https://developer.foursquare.com/overview/versioning
I'm creating app that use autocomplete places google api.
And I don't know what is wrong but all the time I got responses like:
{
"predictions" : [],
"status" : "REQUEST_DENIED"
}
I send req : https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Paris&types=geocode&language=fr&sensor=true&key=mykey
Documentation says :
REQUEST_DENIED indicates that your request was denied, generally because of lack of a sensor parameter.
I have sensor parameter, maybe it is something with api key.
Is there any page where can I get google's log :), to see why I got REQUEST_DENIED?
I use api key from :
http://code.google.com/intl/pl-PL/android/maps-api-signup.html
Maybe I have to get an api key from somewhere else.
You should be able to view your API Key by going to the API Console first:
https://code.google.com/apis/console
If you haven't yet, you will need to create a new "Project" and then enable the Predictions services first by using the On/Off switch.
Please post your results, I have a similar problem with getting the REQUEST_DENIED response, but I've already got the API key and I'm using the sensor parameter like their documentation states.
It is frustrating that Google doesn't give any sort of response code along with REQUEST_DENIED so you can see why it's denying it. This will be difficult to support and troubleshoot in a production environment if this randomly goes out without providing any details as to why.
Update:
I just found this works for me now, but only after changing my requests to GET requests instead of POST. For reasons unknown, Google returns REQUEST_DENIED for POST requests but allows the same request via GET. A quick test for you to see if this is your problem would be to put the URL together with your API key and other parameters and try it through your browser instead. If that works then just rewrite your Android code to use GET instead of POST and you should be all set.
It was solved for me when I exchanged the API key. I was using the one under Android device, I changed it to the one "Key for browser apps (with referers)" and it worked for me although I'm using Android Device.
I recommend using .getJson() to get an error message along with your response to know what is exactly wrong.
For my case in flutter: I used googlePlace!.autocomplete.getJson(value);
and i got the following response.
{ "error_message" : "You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started", "predictions" : [], "status" : "REQUEST_DENIED" }
That's the wrong API key. Follow the steps here to get the right one.
Make sure you API keys are generated correctly and that you have enabled the necessary APIS.
In my case, when designing iOS application - I need to enable Google Maps SDK for iOS, Google Places API for iOS
And most importantly, and without being mentioned by Google (in any other place as well) enable Google Places API Web Service.
With this, I ended a 2 day search for my pesky problem.
And, of course, make sure you use Key for server applications