Ricerca di testo (nuova) utilizza richieste HTTP POST. Passa
i parametri nel corpo della richiesta o nelle intestazioni nell'ambito di una richiesta HTTP POST.
Al contrario, con Text Search (legacy), passi
i parametri URL utilizzando una richiesta HTTP GET.
La mascheratura dei campi è obbligatoria. Devi specificare i campi che vuoi che vengano restituiti
nella risposta. Non esiste un elenco predefinito di campi restituiti. Se ometti
questo elenco, i metodi restituiscono un errore. Per ulteriori informazioni, vedi
FieldMask.
Text Search (New) supporta sia le chiavi API
sia i token OAuth come meccanismo di autenticazione.
In Ricerca di testo (nuova) è supportato solo il formato JSON come formato di risposta.
Ricerca di testo (legacy) ti consente di specificare le coordinate di latitudine e longitudine nella stringa di query. Ad esempio: query=37.4239,-122.0925.
Questa opzione non è supportata nella ricerca di testo (nuova).
La tabella seguente elenca i parametri di Text Search (legacy) che sono stati rinominati o modificati per Text Search (nuovo) oppure i parametri non più supportati.
Parametro corrente
Nuovo parametro
Note
evOptions
Nuovo parametro.
language
languageCode
location
locationBias
maxprice/minprice
priceLevels
opennow
openNow
pagetoken
pageToken
query
textQuery
Obbligatorio in tutte le richieste.
radius
locationBias
Specifica il raggio quando definisci un locationBias.
region
regionCode
type
includedType
Accetta un solo valore.
strictTypeFiltering
Nuovo parametro.
Esempio di richiesta
La seguente richiesta GET di esempio utilizza la ricerca di testo (legacy). In questo esempio, richiedi una risposta JSON contenente informazioni su "Cibo vegetariano piccante a Sydney, Australia" e trasmetti tutti i parametri come parametri URL:
curl -L -X GET \
'https://maps.googleapis.com/maps/api/place/textsearch/json?query=Spicy%20Vegetarian%20Food%20in%20Sydney%20Australia&key=API_KEY
Con la ricerca di testo (nuova), invii una richiesta POST e passi tutti i parametri nel corpo della richiesta JSON o nelle intestazioni come parte della richiesta POST. Questo esempio
utilizza anche una maschera di campo, in modo che la risposta includa solo il nome visualizzato e
l'indirizzo formattato del luogo:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nIntroduction\n\nPlaces API (Legacy) supports\n[Text Search (Legacy)](/maps/documentation/places/web-service/legacy/search-text). If you are familiar with\nText Search (Legacy),\n[Text Search (New)](/maps/documentation/places/web-service/text-search)\nmakes the following changes:\n\n- Text Search (New) uses HTTP POST requests. Pass parameters in the request body or in headers as part of an HTTP POST request. In contrast, with Text Search (Legacy), you pass URL parameters using an HTTP GET request.\n- 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](/maps/documentation/places/web-service/text-search#fieldmask).\n- Text Search (New) supports both [API keys](/maps/documentation/places/web-service/legacy/get-api-key) and [OAuth](/maps/documentation/places/web-service/legacy/oauth-token) tokens as the authentication mechanism.\n- Only JSON is supported as a response format in Text Search (New).\n- Text Search (Legacy) lets you specify latitude and longitude\n coordinates in the query string. For example: `query=37.4239,-122.0925`.\n That option is not supported in Text Search (New).\n\n Use\n [Reverse Geocoding](/maps/documentation/geocoding/requests-reverse-geocoding)\n to search on coordinates and return an address, or\n [Nearby Search (New)](/maps/documentation/places/web-service/nearby-search)\n to find places around a certain location.\n- The JSON response format for Text Search (New) has changed from the format of the legacy APIs. For more details, see [Migrate the Places API response](/maps/documentation/places/web-service/migrate-response).\n\nThe following table lists parameters in Text Search (Legacy) that have been\nrenamed or modified for Text Search (New), or parameters that are no\nlonger supported.\n\n| Current parameter | New parameter | Notes |\n|---------------------|-----------------------|----------------------------------------------------|\n| | `evOptions` | New parameter. |\n| `language` | `languageCode` | |\n| `location` | `locationBias` | |\n| `maxprice/minprice` | `priceLevels` | |\n| `opennow` | `openNow` | |\n| `pagetoken` | `pageToken` | |\n| `query` | `textQuery` | Required in all requests. |\n| `radius` | `locationBias` | Specify the radius when defining a `locationBias`. |\n| `region` | `regionCode` | |\n| `type` | `includedType` | Only takes a single value. |\n| | `strictTypeFiltering` | New parameter. |\n\nExample request\n\nThe following example GET request uses Text Search (Legacy). In this example, you\nrequest a JSON response containing information about \"Spicy Vegetarian Food in\nSydney, Australia\" and pass all parameters as URL parameters: \n\n```curl\ncurl -L -X GET \\\n'https://maps.googleapis.com/maps/api/place/textsearch/json?query=Spicy%20Vegetarian%20Food%20in%20Sydney%20Australia&key=API_KEY\n```\n\nWith Text Search (New), you make a POST request and pass all parameters in\nthe JSON request body or in headers as part of the POST request. This example\nalso uses a field mask so the response only includes the display name and\nformatted address of the place: \n\n```\ncurl -X POST -d '{\n \"textQuery\" : \"Spicy Vegetarian Food in Sydney, Australia\"\n}' \\\n-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \\\n-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress' \\\n'https://places.googleapis.com/v1/places:searchText'\n```"]]