Google Maps Place Details Api Not Returning Phone Numbers
Solution 1:
Latest update is that phone number is a part of a "contact" search on Google Maps API, which costs more. So, it is kept separate from the results. You will not get the phone number with the places ID search.
Reference:- https://developers.google.com/maps/documentation/places/web-service/details
Solution 2:
Place ID ChIJrfXAU3iAhYARyUGceTIdcMg
is of premise
type. Its address is 563 2nd St, San Francisco, CA 94107, USA
which has no public phone number in Google Maps either. Hence the Places API cannot possibly return a phone number because there just isn't one. This is a house.
In order to get formatted_phone_number
, you need to search for places of establishment
(business) type. So if instead of the above premise, you search for the restaurant next to it, i.e. 21st Amendment Brewery & Restaurant
(place ID ChIJYwMBJ-l9hYAR66sAdy3sjKQ
), you will get a phone number, the same one shown in Google Maps.
Take a look at this jsfiddle for Places Details demonstration: https://jsfiddle.net/v8mfzy4r/
As a side-node, place IDs can be retrieved from the Place Autocomplete and Place Search services and you can restrict results to a specific type such as establishment
(for Autocomplete) or any of its subtypes, e.g. restaurant
(for Place Search).
This is all explained in detail in Google's documentation which I recommend you take some time to go through, especially because this is a billable library and Contact Data SKU fields have an additional cost.
Hope this helps!
Solution 3:
Use the fields parameter to specify a comma-separated list of place data types to return.
Fields correspond to Place Details results
Probably the place id you entered is incorrect .
Post a Comment for "Google Maps Place Details Api Not Returning Phone Numbers"