Google Places API : Page Token Errors - google-places-api

I'm basically querying the google places API for stores in atlanta.
https://maps.googleapis.com/maps/api/place/search/json?location=33.7488,-84.3874&radius=50000&sensor=false&key=YOUR_KEY_HERE&types=amusement_park|art_gallery|bakery|bar|beauty_salon|bicycle_store|book_store|bowling_alley|cafe|car_repair|car_wash|clothing_store|florist|furniture_store|gym|hair_care|home_goods_store|jewelry_store|laundry|liquor_store|museum|night_club|pet_store|pharmacy|restaurant|shoe_store|spa|store|veterinary_care|zoo
This as expected returns a result with a page token to get another page of data with the same query.
https://maps.googleapis.com/maps/api/place/search/json?key=YOUR_KEY_HERE&page_token=PAGE_TOKEN_HERE
According to their API this second URL is all I need to get the 2nd page of data. But it ALWAYS returns "REQUEST_DENIED".
"{\n \"html_attributions\" : [],\n \"results\" : [],\n \"status\" : \"REQUEST_DENIED\"\n}\n"
It's not clear WHY I'm getting request denied. I'm nowhere NEAR my daily limit. If I try to run the 2nd URL with ALL the given parameters from the first URL with the Token Included it acts as if I'm requesting the 1st page all over again and ignores the page_token entirely.
Has anybody gotten this page_token to work?!?!?!?!?!

This is a bug in the documentation and will be fixed asap. The correct parameter to use is pagetoken NOT page_token.

Related

How to get share count of an url in Google Plus by passing only url

I want to get share count for a particular url from Google Plus.I tried by passing activity id in Activities: get to get share count. It is working fine but I want the same by passing only url alone.
In Facebook I passed only the Url as input in query url with input url and i got share counts for an url.Is there any ways available in Google Plus to get the share count by passing only url.
Referred site:
jonathanmoore/gist:2640302
Welcome to the world of Google APIs. The method in question
Activites.get
GET https://www.googleapis.com/plus/v1/activities/activityId
Takes a single parameter
activityId string The ID of the activity to get.
This is how this method works you must pass an activityId to it you can not pass a url. I can suggest running an Activies.list first in order to find the activity you seek.
You're best option is to use the Search API. Use the URL as the search term and page through all of the results until no more are found. You then have a number for how many times the URL has been shared publicly on Google+.

How to do Partial Response with Google URL Shortener API

Looking at the documentation on this API there is a page on performance to cut back the number of keys in the JSON dictionary returned. URL Shortener Performance Tips
Of the three dictionary keys returned in the insert request of this API, I am only interested in the shortened URL. The id key. Looking at the above documentation I would have expected this to work:
The POST request https://www.googleapis.com/urlshortener/v1/url?fields=id?key=YOUR-API-KEY
But with the fields=id added the request comes back invalid.
How do you set only a partial response for this API to only return the id key?
Turns out the comment from abraham steered me in the right direction on this problem. I was able to find the Try it tool option without OAuth and it worked also to my surprise. Looking at the request it generated I found that it was a syntax error on my part looking at the url given in my original question. It should be:
?fields=id&
not
?fields=id?

Google Places Search - Next Page Token returns same results

When I call
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=42.9825,-81.254&radius=50000&name=Medical%22Clinic&sensor=false&key=[KEY GOES HERE]
I get a set of results with next_page_token being available
now if i do the same
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=42.9825,-81.254&radius=50000&name=Medical%22Clinic&sensor=false&key=[KEY GOES HERE]&next_page_token=[NEXT PAGE TOKEN GOES HERE]
I get the same results as the first query not the next set of results
The parameter should be pagetoken, not "next_page_token".
Try this:
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=42.9825,-81.254&radius=50000&name=Medical%22Clinic&sensor=false&key=[KEY GOES HERE]&pageToken=[NEXT PAGE TOKEN GOES HERE]
At first request you must use parameters without pagetoken while the following requests only pagetoken parameters, for example:
First request
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=42.9825,-81.254&radius=50000&name=Medical%22Clinic&sensor=false&key=[KEY GOES HERE]
Other request:
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?key=[KEY GOES HERE]&pagetoken=[NEXT PAGE TOKEN GOES HERE]
In case any parameters are entered in subsequent calls in addition to pagetoken and key, in the response the status will be set to INVALID_REQUEST

Google Places API : Next Page Token Errors [duplicate]

I'm basically querying the google places API for stores in atlanta.
https://maps.googleapis.com/maps/api/place/search/json?location=33.7488,-84.3874&radius=50000&sensor=false&key=YOUR_KEY_HERE&types=amusement_park|art_gallery|bakery|bar|beauty_salon|bicycle_store|book_store|bowling_alley|cafe|car_repair|car_wash|clothing_store|florist|furniture_store|gym|hair_care|home_goods_store|jewelry_store|laundry|liquor_store|museum|night_club|pet_store|pharmacy|restaurant|shoe_store|spa|store|veterinary_care|zoo
This as expected returns a result with a page token to get another page of data with the same query.
https://maps.googleapis.com/maps/api/place/search/json?key=YOUR_KEY_HERE&page_token=PAGE_TOKEN_HERE
According to their API this second URL is all I need to get the 2nd page of data. But it ALWAYS returns "REQUEST_DENIED".
"{\n \"html_attributions\" : [],\n \"results\" : [],\n \"status\" : \"REQUEST_DENIED\"\n}\n"
It's not clear WHY I'm getting request denied. I'm nowhere NEAR my daily limit. If I try to run the 2nd URL with ALL the given parameters from the first URL with the Token Included it acts as if I'm requesting the 1st page all over again and ignores the page_token entirely.
Has anybody gotten this page_token to work?!?!?!?!?!
This is a bug in the documentation and will be fixed asap. The correct parameter to use is pagetoken NOT page_token.

Google Places API: Does textSearch supports multiple page results?

I am trying to get next page of results from textSearch call using next_page_token parameter but always get REQUEST DENIED error. According to Accessing Additional Results in google places search there is bug in documentation and pagetoken should be used instead of page_token. I tried both and it does not work for me. I can't find anywhere in documntation if multiple pages results available for textSearch.
"sensor" parameter should be specified for next page query. According to documentation "Setting pagetoken will cause any other parameters to be ignored" and this is not true, you have to specifiy "sensor" and "key" parameters.

Resources