Text Search(新規)への移行
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
はじめに
Places API(以前のバージョン)は、Text Search(以前のバージョン)をサポートしています。テキスト検索(以前のバージョン)をご利用の場合、テキスト検索(新版)では次の変更が行われます。
- テキスト検索(新版)では HTTP POST リクエストを使用します。HTTP POST リクエストの一部として、リクエスト本文またはヘッダーでパラメータを渡します。一方、テキスト検索(以前のバージョン)では、HTTP GET リクエストを使用して URL パラメータを渡します。
- フィールドのマスキングが必要です。レスポンスで返すフィールドを指定する必要があります。返されるフィールドのデフォルトのリストはありません。このリストを省略すると、メソッドはエラーを返します。詳細については、FieldMask をご覧ください。
- テキスト検索(新版)では、認証メカニズムとして API キーと OAuth トークンの両方がサポートされています。
- テキスト検索(新版)では、レスポンス形式として JSON のみがサポートされています。
テキスト検索(以前のバージョン)では、クエリ文字列で緯度と経度の座標を指定できます。例: query=37.4239,-122.0925
。
このオプションはテキスト検索(新版)ではサポートされていません。
リバース ジオコーディングを使用して座標で検索して住所を返すか、Nearby Search(新版)を使用して特定の場所の周辺にある場所を検索します。
- テキスト検索(新版)の JSON レスポンス形式が、以前の API の形式から変更されました。詳しくは、Places API レスポンスを移行するをご覧ください。
次の表に、テキスト検索(新しい)で名前が変更または修正されたテキスト検索(以前の)のパラメータ、またはサポートされなくなったパラメータを示します。
現在のパラメータ |
新しいパラメータ |
メモ |
|
evOptions |
新しいパラメータ。 |
language |
languageCode |
|
location |
locationBias |
|
maxprice/minprice |
priceLevels |
|
opennow |
openNow |
|
pagetoken |
pageToken |
|
query |
textQuery |
すべてのリクエストで必須です。 |
radius |
locationBias |
locationBias を定義するときに半径を指定します。 |
region |
regionCode |
|
type |
includedType |
単一の値のみを受け取ります。 |
|
strictTypeFiltering |
新しいパラメータ。 |
リクエスト例
次の GET リクエストの例では、テキスト検索(以前のバージョン)を使用しています。この例では、「オーストラリアのシドニーにあるスパイシーなベジタリアン料理」に関する情報を含む JSON レスポンスをリクエストし、すべてのパラメータを URL パラメータとして渡します。
curl -L -X GET \
'https://maps.googleapis.com/maps/api/place/textsearch/json?query=Spicy%20Vegetarian%20Food%20in%20Sydney%20Australia&key=API_KEY
テキスト検索(新版)では、POST リクエストを作成し、すべてのパラメータを JSON リクエスト本文またはヘッダーで POST リクエストの一部として渡します。この例では、フィールド マスクも使用しているため、レスポンスには場所の表示名と書式設定された住所のみが含まれます。
curl -X POST -d '{
"textQuery" : "Spicy Vegetarian Food in Sydney, Australia"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress' \
'https://places.googleapis.com/v1/places:searchText'
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-29 UTC。
[null,null,["最終更新日 2025-08-29 UTC。"],[],[],null,["# Migrate to Text Search (New)\n\n**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------------\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---------------\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```"]]