Reputation: 1835
I can get place details from Google places API when I know the reference by using:
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:
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?
Upvotes: 10
Views: 41308
Reputation: 20670
You can search Place data by PlaceID
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJF7QkuDsDLz4R0rJ4SsxFl9w&key=YOUR_KEY
Upvotes: 14
Reputation: 148
It is now possible to fetch place data by placeId:
https://developers.google.com/maps/documentation/javascript/examples/place-details
Upvotes: 11
Reputation: 41
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
Upvotes: 3
Reputation: 1051
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
Upvotes: 7