Places API supports the existing Place Details. If you are familiar with the existing Places API, the new version of Place Details makes the following changes:
- Field masking is required. You must specify which fields you want returned in the response. There is no default list of returned fields. If you omit this list, the methods return an error. For more information, see FieldMask.
- The new Place Details supports both API keys andOAuth tokens as the authentication mechanism.
- Only JSON is supported as a response format in the new Place Details.
- The JSON response format for the Place Details (New) API has changed from the format of the existing APIs. For more details, see Migrate the Places API response.
The following table lists parameters in the existing Place Details that have been renamed or modified for the new Place Details, or parameters that are no longer supported.
Current parameter | New parameter | Notes |
---|---|---|
place_id |
places/PLACE_ID |
The stringplaces/PLACE_ID is also called the
placeresource name.In the response from a Place Details (New),
Nearby Search (New), and Text Search (New)
request, this string is contained in thename field of the response.
The standalone place ID is contained in theid field of the response. |
language |
languageCode |
|
region |
regionCode |
Example request
The following example GET request uses the existing
Place Details. In this example, you request a JSON
response containing information about a place ID and pass all parameters as URL
parameters. This example also usesfields
so the response only includes the
display name and formatted address of the place:
curl -L -X GET \ 'https://maps.googleapis /maps/api/place/details/json?place_id=ChIJj61dQgK6j4AR4GeTYWZsKWw&fields=name%2Cformatted_address&key=API_KEY'
With Place Details (New), you make a GET request and pass all parameters in URL parameters and headers as part of the request. This example also uses a field mask so the response only includes the display name and formatted address of the place:
curl -X GET -H 'Content-Type: application/json' \ -H "X-Goog-Api-Key:API_KEY"\ -H" X-Goog-FieldMask: displayName,formattedAddress "\ https://places.googleapis /v1/places/ChIJj61dQgK6j4AR4GeTYWZsKWw
The stringplaces/PLACE_ID
is also called the place
resource name.In the response from a Place Details
(New), Nearby Search (New), and
Text Search (New) request, this string is contained in
thename
field of the response. The standalone place ID is contained in the
id
field of the response.