Google Maps -> Places API
Readonly
Action summary
Google Maps -> Places API
Google Maps → Places API (Search Text)
Overview
This Xano action integrates with the Google Maps Places API to search for places based on a text query. It supports advanced filtering, language localization, pagination, and location biasing to refine search results.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
google_key |
text | Yes | Your Google Maps API key (from settings registry). |
query |
text | Yes | The text string to search for places (e.g., "coffee shops near me"). |
field_mask |
text | No | Comma-separated list of fields to return (e.g., places.displayName). |
language_code |
text | No | Language code for the results (e.g., "en", "fr"). |
page_token |
text | No | Token for fetching the next page of results. |
page_size |
integer | No | Number of results to return per page. |
location_bias |
json | No | JSON object to bias search results by location (e.g., circle, rectangle). |
Function Stack
1. Prepare field_mask Parameter
- Create Variable:
Sets
field_masktoplaces.displayName,places.formattedAddress,places.priceLevel,nextPageTokenif not provided, or uses the input value.
2. Google Maps API Request
- API Request:
Sends a request to
https://places.googleapis.com/v1/places:searchTextwith the specified parameters (query,field_mask,language_code,page_token,page_size,location_bias, andgoogle_key). - Precondition:
Ensures the API response status is
200(success).
3. Response
- Returns the parsed result from the Google Maps Places API response.
Example Usage
Request
{
"query": "pizza restaurants in Mumbai",
"field_mask": "places.displayName,places.formattedAddress,places.priceLevel",
"language_code": "en",
"page_size": 5,
"location_bias": {
"circle": {
"center": {
"latitude": 19.0760,
"longitude": 72.8777
},
"radius": 5000
}
}
}
Response
{
"places": [
{
"displayName": "Joey's Pizza",
"formattedAddress": "Shop 1, Mumbai, Maharashtra 400053, India",
"priceLevel": 2
}
// ... up to 5 results
],
"nextPageToken": "ATtYBwK..."
}
Notes
- The
google_keymust be valid and enabled for the Places API. - The
field_maskparameter controls which fields are returned; if omitted, a default set is used. - Use
location_biasto focus results within a specific area (circle or rectangle). - Pagination is supported via
page_tokenandpage_size.
Troubleshooting
REQUEST_DENIED: Verify your API key and ensure it has Places API access enabled.INVALID_REQUEST: Check that the requiredqueryparameter is provided and valid.ZERO_RESULTS: No places matched the query; try refining your search.- Other Errors: Refer to the Google Maps Places API documentation for additional error details.
References
Version notes
2025-05-19 15:42:40
Current