オートコンプリート(新)に移行する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
はじめに
Places API は、Place Autocomplete(従来版)と Query Autocomplete(従来版)の API をサポートしています。これらの API をよくご存知の場合は、予測入力(新版)で次の変更が行われます。
- Autocomplete(新版)は HTTP POST リクエストを使用します。HTTP POST リクエストの一部として、リクエスト本文またはヘッダーでパラメータを渡します。一方、以前の API では、HTTP GET リクエストを使用して URL パラメータを渡します。
- Autocomplete(新機能)は、認証メカニズムとして API キーと OAuth トークンの両方をサポートしています。
- Autocomplete(新機能)では、レスポンス形式として JSON のみがサポートされています。
次の表に、Autocomplete(新機能)で名前が変更または修正された Place Autocomplete(従来版)と Query Autocomplete(従来版)のパラメータ、またはサポートされなくなったパラメータを示します。
現在のパラメータ |
新しいパラメータ |
メモ |
components |
includedRegionCodes |
|
language |
languageCode |
|
location |
locationBias |
|
ipbias |
|
locationBias と locationRestriction の両方を省略すると、API はデフォルトで IP バイアスを使用します。 |
offset |
inputOffset |
|
radius |
locationBias または locationRestriction |
|
region |
regionCode |
|
stricbounds |
locationRestriction |
|
sessiontoken |
sessionToken |
|
types |
includedPrimaryTypes |
|
リクエスト例
次の GET リクエストの例では、Place Autocomplete(レガシー)を使用しています。この例では、タイプ establishment
の「Amoeba」という場所に関する情報を含む JSON レスポンスをリクエストし、すべてのパラメータを URL パラメータとして渡します。
curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amoeba&types=establishment&location=37.76999%2C-122.44696&radius=500&key=YOUR_API_KEY'
Autocomplete(新機能)では、POST リクエストを作成し、すべてのパラメータを JSON リクエスト本文またはヘッダーで POST リクエストの一部として渡します。
Autocomplete(新版)リクエストではフィールド マスクは必須ではありませんが、レスポンスで特定の結果をフィルタリングするために使用できます。たとえば、次のリクエストではフィールド マスクを使用しているため、レスポンスには候補の suggestions.placePrediction.text
のみが含まれます。
curl -X POST -d '{
"input": "Amoeba",
"locationBias": {
"circle": {
"center": {
"latitude": 37.76999,
"longitude": -122.44696
},
"radius": 500.0
}
}
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: suggestions.placePrediction.text' \
https://places.googleapis.com/v1/places:autocomplete
フィールド マスクの使用について詳しくは、プレイスの詳細(新版)をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-29 UTC。
[null,null,["最終更新日 2025-08-29 UTC。"],[],[],null,["# Migrate to Autocomplete (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 supports the\n[Place Autocomplete (Legacy)](/maps/documentation/places/web-service/autocomplete)\nand [Query Autocomplete (Legacy)](/maps/documentation/places/web-service/query) APIs.\nIf you are familiar with these APIs, Autocomplete (New) makes the following changes:\n\n- Autocomplete (New) uses HTTP POST requests. Pass parameters in the request body or in headers as part of an HTTP POST request. In contrast, with the legacy APIs, you pass URL parameters using an HTTP GET request.\n- Autocomplete (New) supports both [API keys](/maps/documentation/places/web-service/get-api-key) and [OAuth](/maps/documentation/places/web-service/oauth-token) tokens as the authentication mechanism.\n- Only JSON is supported as a response format in Autocomplete (New).\n\nThe following table lists parameters in Place Autocomplete (Legacy) and Query Autocomplete (Legacy) that have been renamed or modified for Autocomplete (New), or parameters that are no longer supported.\n\n| Current parameter | New parameter | Notes |\n|-------------------|-----------------------------------------|-----------------------------------------------------------------------------------------------------|\n| `components` | `includedRegionCodes` | |\n| `language` | `languageCode` | |\n| `location` | `locationBias` | |\n| `ipbias` | | If you omit both `locationBias` and `locationRestriction`, then the API uses IP biasing by default. |\n| `offset` | `inputOffset` | |\n| `radius` | `locationBias` or `locationRestriction` | |\n| `region` | `regionCode` | |\n| `stricbounds` | `locationRestriction` | |\n| `sessiontoken` | `sessionToken` | |\n| `types` | `includedPrimaryTypes` | |\n\nExample request\n---------------\n\nThe following example GET request uses Place Autocomplete (Legacy). In this\nexample, you request a JSON response containing information about places called\n\"Amoeba\" that are of type `establishment` and pass all parameters as URL\nparameters: \n\n```curl\ncurl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amoeba&types=establishment&location=37.76999%2C-122.44696&radius=500&key=YOUR_API_KEY'\n```\n\nWith Autocomplete (New), you make a POST request and pass all parameters\nin the JSON request body or in headers as part of the POST request.\n\nField masks are not required for Autocomplete (New) requests, but they can\nbe used to filter for specific results in the response. For example, the\nfollowing request uses a field mask so the response only includes the\n`suggestions.placePrediction.text` of the suggestion: \n\n```curl\ncurl -X POST -d '{\n \"input\": \"Amoeba\",\n \"locationBias\": {\n \"circle\": {\n \"center\": {\n \"latitude\": 37.76999,\n \"longitude\": -122.44696\n },\n \"radius\": 500.0\n }\n }\n}' \\\n-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \\\n-H 'X-Goog-FieldMask: suggestions.placePrediction.text' \\\nhttps://places.googleapis.com/v1/places:autocomplete\n```\n\nTo learn more about using field masks, see\n[Place Details (New)](/maps/documentation/places/web-service/place-details#fieldmask)."]]