Tính năng Tự động hoàn thành (Mới) sử dụng các yêu cầu HTTP POST. Truyền các tham số trong nội dung yêu cầu hoặc trong tiêu đề dưới dạng một phần của yêu cầu POST qua HTTP. Ngược lại, với các API cũ, bạn sẽ truyền các tham số URL bằng yêu cầu HTTP GET.
Tính năng Tự động hoàn thành (Mới) hỗ trợ cả khoá API và mã thông báo OAuth làm cơ chế xác thực.
Chỉ JSON được hỗ trợ làm định dạng phản hồi trong tính năng Tự động hoàn thành (Mới).
Bảng sau đây liệt kê các tham số trong tính năng Tự động hoàn thành địa điểm (Phiên bản cũ) và Tự động hoàn thành cụm từ tìm kiếm (Phiên bản cũ) đã được đổi tên hoặc sửa đổi cho tính năng Tự động hoàn thành (Phiên bản mới), hoặc các tham số không còn được hỗ trợ.
Tham số hiện tại
Thông số mới
Ghi chú
components
includedRegionCodes
language
languageCode
location
locationBias
ipbias
Nếu bạn bỏ qua cả locationBias và locationRestriction, thì API sẽ sử dụng tính năng phân cực IP theo mặc định.
offset
inputOffset
radius
locationBias hoặc locationRestriction
region
regionCode
stricbounds
locationRestriction
sessiontoken
sessionToken
types
includedPrimaryTypes
Ví dụ về yêu cầu
Yêu cầu GET trong ví dụ sau đây sử dụng tính năng Place Autocomplete (Cũ). Trong ví dụ này, bạn yêu cầu một phản hồi JSON chứa thông tin về những địa điểm có tên "Amoeba" thuộc loại establishment và truyền tất cả các tham số dưới dạng tham số 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'
Với tính năng Tự động hoàn thành (Mới), bạn thực hiện yêu cầu POST và truyền tất cả các tham số trong nội dung yêu cầu JSON hoặc trong tiêu đề như một phần của yêu cầu POST.
Bạn không bắt buộc phải dùng mặt nạ trường cho các yêu cầu Autocomplete (Mới), nhưng bạn có thể dùng mặt nạ trường để lọc các kết quả cụ thể trong phản hồi. Ví dụ: yêu cầu sau đây sử dụng một mặt nạ trường để phản hồi chỉ bao gồm suggestions.placePrediction.text của đề xuất:
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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 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\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)."]]