How to get the cid in the Google Place URL? - google-maps

I want to send a request to the google places (not google place API), I don't need to get the data in XML or JSON, i just want to get the place page and display it to the user.
This url works for me http://maps.google.com/maps/place?cid=2124238351431937390 but I was wondering how to get this "cid", this seems to a unique id for a business. I went to get a sample response from the google place api but didnt find this cid for the same business as any of the response fields.
Does anyone know how can I get this "cid"?
Thanks
Nishant

Here's how to get the cid of a place. Put your own API key and name of the restaurant that you want to find the cid).
Step 1: Call Places Request API something like this
https://maps.googleapis.com/maps/api/place/search/json?
location=47.6757453,-122.3149514&
radius=500&
types=food&
name=Pies&
sensor=false&
key=AIzaSyZZZZZZZZZZZZ
These urls are one line. They are broken into multiple lines to make it easier to read.
Note the name parameter is the restaurant called "Pies and Pints" for which I want to get the cid, lat&lng is the location information of the same place.
The response will contain a "reference" key which is unique for every place.
Step 2: Take the "reference" value from above and call Places Details API, something like this:
https://maps.googleapis.com/maps/api/place/details/json?
reference=CnRiAAAATIbN_GasBkBS6xLoO_HzR7owHvGaDXbG5QIbLf7eSZtIc4ZpvbBPxhVPEKZs5c4ptqxeKNVLCXZEoSOwLMn9nqkRc6khFuJFPh5jy-hjrh3Xr7X75w3-TIoTl3E-dKiZ2LcHuReWKZxydI75vH6zyRIQxfoiOKfFjo_1O-hnnllafxoU9tU_HoZos8C5uWextAk08RMukCY&
sensor=true&
key=AIzaSyBnI5DyG7ZZZZZZZZZZZZ
Check the response of this API, the key "url" contains the "cid".
Consult the google places documentation to learn more about their APIs.

It looks like the URL no longer contains the CID but rather the plus.google.com link

To get the CID in Google Maps Places Details API you just pass the URL value in the fields parameter. This will get you the URL of the particular location and there you can find the CID.
"url": "https://maps.google.com/?cid=12XXXXXXXXXXXXXXX"

Related

(Instagram) Scrape All Facebook places_id 's in a region from without access token

How do I find all of the facebook_places_id's in Brooklyn? I need them to scrape Instagram's public website.
I am able to lookup places_id's for a single location by name. I am also able to query all photos/videos and metadata once I have the location ID. All of this is available without needing an access token.
Look up facebook_places_id 's
This url allows you to look up location_ids by name. For example, this returns close matches for "Brooklyn, New York" (you can enter this into any browser and see the result, no access key or login required. I recommend Firefox):
https://www.instagram.com/web/search/topsearch/?context=place&query=brooklyn+new+york
From the JSON returned, we can see that "Brooklyn, New York" has the facebook_places_id 212950988
Scrape metadata for a given facebook_places_id
This url will return JSON metadata about posts in Brooklyn:
https://www.instagram.com/graphql/query/?query_id=17881432870018455&id=212950988&first=12&after=0"
So I can get everything I want if I know the place, I just need a full list of places to ask for.
https://www.instagram.com/web/search/topsearch/?context=place&query=brooklyn+new+york
The id you get from the above API call is not facebook_places_id, it is instagram_location_id that you use in API call to get location posts.
Below is Facebook Graph API call to get facebook_places_id in one city or region specified by lat,lng and distance. However this required a facebook access_token
https://graph.facebook.com/search?q=coffee&type=place&center=45.5230622,-122.67648150000002&distance=5000&access_token=XXX
You can get the list of facebook_places_id and then use the below API call to get corresponding instagram_location_id, which you can use to get location posts data.
https://api.instagram.com/v1/locations/search?facebook_places_id=694471784029871&access_token=XXX
This API call requires a instagram access_token

Getting URL for the place using Google Places API

So I am able to successfully get a list of places but I just realized that the results do not contain the URL for the establishment. For e.g. I get Pizza Hut and the physical address for it but I do not get the URL for it (www.pizzahut.com). Is there a way to get this may be by doing an additional query?
If the external website is available for the place, it should be set in website in the query result. If url is set, then that is the Google Place Page URL entered for the establishment. The reference result may be used to query for the same place later. (Documentation)

is it possible to retrieve google contacts informations in one with url Json or XML?

I have been able to retrieve little infos (mainly email and id ) in JSon using Oauth2 the url:
https://www.google.com/m8/feeds/contacts/default/full?&max-results=5&alt=json
Now I want more details like name/ phone number . Is it possible in one call with one url ?
Thanks
I think you may be using the google example code. The information you need is retrived by this url, part of the example code is wrong, it seems like the information is not retrived.
You'll find these stackoverflow links useful:
Google Contacts API XML parsing with PHP
Fetch Contacts from google

Get place from Google Places API using ID

I can get place details from Google places API when I know the reference by using:
https://maps.googleapis.com/maps/api/place/details/json?reference=CmRYAAAAciqGsTRX1mXRvuXSH2ErwW-jCINE1aLiwP64MCWDN5vkXvXoQGPKldMfmdGyqWSpm7BEYCgDm-iv7Kc2PF7QA7brMAwBbAcqMr5i1f4PwTpaovIZjysCEZTry8Ez30wpEhCNCXpynextCld2EBsDkRKsGhSLayuRyFsex6JA6NPh9dyupoTH3g&sensor=true&key=API_KEY_HERE
However, I want to get the same information by using the ID instead. So the same place in the query above would be something like:
https://maps.googleapis.com/maps/api/place/details/json?id=4f89212bf76dde31f092cfc14d7506555d85b5c7&sensor=true&key=API_KEY_HERE
Is such a thing possible?
This will be part of a search filter I'm building, part of which is location. My search parameters are passed to the url, so I plan to do the same with the selected location from the places autocomplete. Using id is much shorter than reference, so more suitable for the querystring. Unless there is a better way to do it?
You can search Place data by PlaceID
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJF7QkuDsDLz4R0rJ4SsxFl9w&key=YOUR_KEY
It is now possible to fetch place data by placeId:
https://developers.google.com/maps/documentation/javascript/examples/place-details
It is not possible to get a place details with id, you do need to use the reference.
as specifically mentioned in the bottom of this link - http://goo.gl/KFDbl
Apparently both the id and reference are deprecated anyway.
From the Google Places Autocomplete Docs (Aug 2014):
"Note: The id and reference fields are deprecated as of June 24, 2014. They are replaced by the new place ID, a unique identifier that can be used to compare places and to retrieve information about a place. The Places API currently returns a place_id in all responses, and accepts a placeid in the Place Details and Place Delete requests. Soon after June 24, 2015, the API will stop returning the id and reference fields in responses. Some time later, the API will no longer accept the reference in requests. We recommend that you update your code to use the new place ID instead of id and reference as soon as possible. "
https://developers.google.com/places/documentation/autocomplete

Missing formatted_phone_number field in Google Places autocomplete API's getPlace Details response

I am trying to use Google places autocomplete API for one of my application.
It works allright. But, I dont get the key formatted_phone_number in the result for the place detail request.
This is what I've been trying:
Step1: Call to autocomplete api with keyword "Mike's chili" as below:
https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=Mike%27s%20chili&types=establishment&sensor=false&key=AIzaSyC2L1pPVbgCXUFuobrHS6vjN1RPbjibaME
Step2: Use the reference key in the first result of above request and make call to google Places Detail api as below:
https://maps.googleapis.com/maps/api/place/details/xml?reference=CmReAAAAtR79EFJeGGLjMflCzFh_n5Rl4rEJfU_dg-zs-1ZyPVHQQmMneLO2P0J4APa3dpV2YvscqbyOK50iARnevHcUOnRvAc33hDGQQAPWxJbzSTw0GF3nDOXP1R7Zep68Yc37EhAmWbhrqVT3Ht-SffUHi1jgGhR81n4FV2ywKBkmbS8_4MrsI85w8w&sensor=false&key=AIzaSyC2L1pPVbgCXUFuobrHS6vjN1RPbjibaME
But, I dont get the field called formatted_phone_number in return. This happens for some of the other results also.
When I search for the same in Google maps, I get the phone number.
Can someone please help me on this?