Get place from Google Places API using ID

36,448

Solution 1

It is now possible to fetch place data by placeId:

https://developers.google.com/maps/documentation/javascript/examples/place-details

Solution 2

You can search Place data by PlaceID

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJF7QkuDsDLz4R0rJ4SsxFl9w&key=YOUR_KEY

Solution 3

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

Solution 4

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

Share:
36,448
iltdev
Author by

iltdev

Updated on January 26, 2020

Comments