Get a location's details
The /geoservices/place
endpoint can be used to obtain detailed information about a location from Google’s Places database. This endpoint requires the use of a Place ID, which uniquely identifies a place in Google’s system and are available for most locations, including businesses, landmarks, parks, roads, and intersections. The Place ID can be obtained using the /geoservices/autocomplete
endpoint. Note that one place can have multiple different place IDs and they may also change over time.
The location details that are returned include address fields, such as street number, area, and postal code, as well as the geographic co-ordinates.
Request a place’s details
- Endpoint:
/geoservices/place
- Operation:
POST
Request parameters
Parameter | Mandatory/optional | Description |
---|---|---|
placeID |
Mandatory | A string of characters that uniquely identifies a place in Google’s system. It can be obtained from the autocomplete endpoint. |
sessionId |
Mandatory | A user-generated UUID. It can be used for a single session, which consists of multiple autocomplete requests and ends with a request for a place’s details via the /geoservices/place endpoint. |
For more information, please see the API documentation.
Example
This examples shows how to use the /geoservices/autocomplete
and /geoservices/place
endpoints to get a place’s details.
- Generate a UUID using a free tool such as Online UUID Generator.
- Send a
POST
request to the/geoservices/autocomplete
endpoint:
{
"input": "47 Warner",
"sessionId": "2077dcb0-1238-4d4d-b75a-511af289fa16"
}
The response contains the top five matches for your input
:
{
"result": {
"predictions": [
{
"description": "47 Warner Street, Fortitude Valley QLD, Australia",
"placeId": "ChIJ56eaUPJZkWsRiGOVbF9RoVA"
},
{
"description": "47 Warner Road, Oropi, New Zealand",
"placeId": "ChIJcU3eovrQbW0RsUTOtkyN2JQ"
},
{
"description": "47 Warner Street, Moncton, NB, Canada",
"placeId": "ChIJYSCOo6G-oEwRkaMuO2m2M9c"
},
{
"description": "47 Warner's Lane, Ranelagh, Dublin 6, Ireland",
"placeId": "ChIJiXBeEqMOZ0gRfVJ2ib3keFA"
},
{
"description": "47 Warners Avenue, Bondi Beach NSW, Australia",
"placeId": "ChIJf3TwNZ-tEmsRGxJEG-08Pv8"
}
],
"status": "OK",
"errorMessage": null
}
}
- Copy the
placeId
of the address you want from the list.
Note: If the place you are looking for is not in the list, retry the request with more precise keywords in the input
.
- Send a
POST
request to the/geoservices/place
endpoint using the same session ID and the place ID from the result above:
{
"placeId": "ChIJ56eaUPJZkWsRiGOVbF9RoVA",
"sessionId": "2077dcb0-1238-4d4d-b75a-511af289fa16"
}
This request returns the following place information:
{
"result": {
"addressComponents": {
"streetNumber": "47",
"route": "Warner St",
"subLocality": null,
"locality": "Fortitude Valley",
"area2": "Brisbane",
"area1": "QLD",
"country": "Australia",
"postalCode": "4006"
},
"formattedAddress": "47 Warner St, Fortitude Valley QLD 4006, Australia",
"geometry": {
"lat": -27.4569042,
"lng": 153.0349271
}
}
}
Feedback
Was this page helpful?