نقل البيانات إلى الإكمال التلقائي (جديد)
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
المطوّرون في المنطقة الاقتصادية الأوروبية
مقدمة
تتيح Places API استخدام واجهتَي برمجة التطبيقات
Place Autocomplete (الإصدار القديم)
وQuery Autocomplete (الإصدار القديم).
إذا كنت على دراية بهذه الواجهات، سيتم إجراء التغييرات التالية في ميزة "الإكمال التلقائي (جديدة)":
- تستخدم ميزة "الإكمال التلقائي" (جديدة) طلبات HTTP POST. يمكنك تمرير المَعلمات في نص الطلب أو في العناوين كجزء من طلب HTTP POST. في المقابل،
مع واجهات برمجة التطبيقات القديمة، يمكنك تمرير مَعلمات عنوان URL باستخدام
طلب HTTP GET.
- تتيح ميزة "الإكمال التلقائي" (جديدة) استخدام كل من مفاتيح واجهة برمجة التطبيقات ورموز OAuth المميزة كآلية مصادقة.
- لا يتوفّر سوى تنسيق JSON كشكل استجابة في ميزة "الإكمال التلقائي (جديدة)".
يسرد الجدول التالي المَعلمات في Place Autocomplete (الإصدار القديم) وQuery Autocomplete (الإصدار القديم) التي تمت إعادة تسميتها أو تعديلها في Autocomplete (الإصدار الجديد)، أو المَعلمات التي لم يعُد يتم توفيرها.
المَعلمة الحالية |
معلَمة جديدة |
ملاحظات |
components |
includedRegionCodes |
|
language |
languageCode |
|
location |
locationBias |
|
ipbias |
|
في حال عدم إدخال كل من locationBias وlocationRestriction ، تستخدم واجهة برمجة التطبيقات ميزة "تفضيل عنوان IP" تلقائيًا. |
offset |
inputOffset |
|
radius |
locationBias أو locationRestriction |
|
region |
regionCode |
|
stricbounds |
locationRestriction |
|
sessiontoken |
sessionToken |
|
types |
includedPrimaryTypes |
|
مثال على الطلب
يستخدم مثال طلب GET التالي ميزة "الإكمال التلقائي للأماكن" (الإصدار القديم). في هذا المثال، تطلب استجابة بتنسيق JSON تتضمّن معلومات حول أماكن تُعرف باسم "Amoeba" من النوع establishment
، وتمرّر جميع المَعلمات كمَعلمات عنوان 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'
باستخدام ميزة "الإكمال التلقائي (جديدة)"، يمكنك إرسال طلب POST وتمرير جميع المَعلمات في نص طلب JSON أو في العناوين كجزء من طلب POST.
لا تكون أقنعة الحقول مطلوبة لطلبات الإكمال التلقائي (جديد)، ولكن يمكن استخدامها لفلترة نتائج معيّنة في الردّ. على سبيل المثال، يستخدم الطلب التالي قناع حقل حتى لا يتضمّن الرد سوى 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
لمزيد من المعلومات حول استخدام أقنعة الحقول، يُرجى الاطّلاع على تفاصيل المكان (الإصدار الجديد).
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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)."]]