ACTIONS
  • Home
  • My Actions
  • My Projects
  • My Packages
Google Maps -> Places API
Readonly
Google Maps → Places API (Search Text)

Action summary

Google Maps -> Places API

Xano / Google Maps

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_mask to places.displayName,places.formattedAddress,places.priceLevel,nextPageToken if not provided, or uses the input value.

2. Google Maps API Request

  • API Request: Sends a request to https://places.googleapis.com/v1/places:searchText with the specified parameters (query, field_mask, language_code, page_token, page_size, location_bias, and google_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_key must be valid and enabled for the Places API.
  • The field_mask parameter controls which fields are returned; if omitted, a default set is used.
  • Use location_bias to focus results within a specific area (circle or rectangle).
  • Pagination is supported via page_token and page_size.

Troubleshooting

  • REQUEST_DENIED: Verify your API key and ensure it has Places API access enabled.
  • INVALID_REQUEST: Check that the required query parameter 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

  • Google Maps Places API: Search Text
  • Google Maps Places API Error Messages

Version notes

2025-05-19 15:42:40
Current
2025-06-30T11:08:45.000+00:00