翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
アドレスを完了する方法
オートコンプリート API を使用すると、部分型アドレスを完了し、エンドユーザーに標準化された入力を提供し、データ入力中の効率を向上させることができます。
潜在的なユースケース
-
チェックアウト時に住所を入力する: 顧客がチェックアウトフォームに入力すると、住所の入力が正確で迅速になります。
-
国固有の住所の入力: 特定の国への提案を制限して、ユーザーの所在地へのコンプライアンスまたは関連性を確保します。
例
この例では、レスポンスを簡潔かつ費用対効果の高いものにするために、最小限のデータが返されます。完全な場所の詳細は、後で GetPlace API で PlaceId を使用して取得できます。
- Sample request
-
{ "QueryText": "100 McCullum Rd" }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "United Kingdom, E3 5JB, London, 100 McCullum Road" } ], "QueryRefinements": [] }
- cURL
-
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/autocomplete?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "100 McCullum Rd" }'
- AWS CLI
-
aws geo-places autocomplete --key ${YourKey} --query-text "100 McCullum Rd"
この例では、複数のアドレス候補が返されるため、ユーザーはフォームフィールドを正確に入力するための標準化されたアドレス形式を選択できます。
- Sample request
-
{ "QueryText": "100 McCullum Rd", "AdditionalFeatures": [ "Core" ] }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "United Kingdom, E3 5JB, London, 100 McCullum Road", "Address": { "Label": "100 McCullum Road, London, E3 5JB, United Kingdom", "Country": { "Code2": "GB", "Code3": "GBR", "Name": "United Kingdom" }, "Region": { "Name": "England" }, "SubRegion": { "Code": "LDN", "Name": "London" }, "Locality": "London", "District": "Bow", "PostalCode": "E3 5JB", "Street": "McCullum Road", "StreetComponents": [ { "BaseName": "McCullum", "Type": "Road", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Language": "en" } ], "AddressNumber": "100" }, "Language": "en", "Highlights": { "Title": [ { "StartIndex": 32, "EndIndex": 35, "Value": "100" }, { "StartIndex": 36, "EndIndex": 49, "Value": "McCullum Road" } ], "Address": { "Label": [ { "StartIndex": 0, "EndIndex": 3, "Value": "100" }, { "StartIndex": 4, "EndIndex": 17, "Value": "McCullum Road" } ], "Street": [ { "StartIndex": 0, "EndIndex": 13, "Value": "McCullum Road" } ], "AddressNumber": [ { "StartIndex": 0, "EndIndex": 3, "Value": "100" } ] } } }, ... ], "QueryRefinements": [] }
- cURL
-
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/autocomplete?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryText": "100 McCullum Rd", "AdditionalFeatures": [ "Core" ] }'
- AWS CLI
-
aws geo-places autocomplete --key ${YourKey} --query-text "100 McCullum Rd" --additional-features "Core"
オートコンプリートを使用する
フィルターを使用してアドレスを完了する方法