Nearby Search पर माइग्रेट करना (नया)
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यूरोपियन इकनॉमिक एरिया (ईईए) के डेवलपर
परिचय
Places API, आस-पास की जगहें ढूंढने की सुविधा (लेगसी) के साथ काम करता है.
अगर आपने Nearby Search (लेगसी) का इस्तेमाल किया है, तो
Nearby Search (नया) में ये बदलाव किए गए हैं:
- आस-पास की जगहों के लिए खोज करने की नई सुविधा, एचटीटीपी पोस्ट अनुरोधों का इस्तेमाल करती है.
एचटीटीपी POST अनुरोध के हिस्से के तौर पर, अनुरोध के मुख्य हिस्से या हेडर में पैरामीटर पास करें. इसके उलट, आस-पास की जगहों को खोजने की सुविधा (लेगसी) में,
एचटीटीपी GET अनुरोध का इस्तेमाल करके यूआरएल पैरामीटर पास किए जाते हैं.
- फ़ाइल मास्क करना ज़रूरी है. आपको यह बताना होगा कि रिस्पॉन्स में आपको कौनसे फ़ील्ड चाहिए. लौटाए गए फ़ील्ड की कोई डिफ़ॉल्ट सूची नहीं होती. इस सूची को शामिल न करने पर, ये तरीके गड़बड़ी दिखाते हैं. ज़्यादा जानकारी के लिए, FieldMask देखें.
- Nearby Search (नया वर्शन) में पुष्टि करने के तरीके के तौर पर, एपीआई पासकोड और OAuth टोकन, दोनों का इस्तेमाल किया जा सकता है.
- 'आस-पास खोजें (नया वर्शन)' में, जवाब के फ़ॉर्मैट के तौर पर सिर्फ़ JSON का इस्तेमाल किया जा सकता है.
- टेक्स्ट क्वेरी वाले सभी अनुरोधों के लिए, अब टेक्स्ट से खोजने की सुविधा (नई) का इस्तेमाल करना चाहिए. ऐसा इसलिए, क्योंकि आस-पास खोजने की सुविधा (नई) में टेक्स्ट डालने की सुविधा काम नहीं करती.
- Nearby Search (New) के लिए JSON रिस्पॉन्स फ़ॉर्मैट, लेगसी एपीआई के फ़ॉर्मैट से बदल गया है. ज़्यादा जानकारी के लिए, Places API के रिस्पॉन्स को माइग्रेट करना लेख पढ़ें.
यहां दी गई टेबल में, आस-पास की जगहें खोजने की सुविधा (लेगसी) के उन पैरामीटर की सूची दी गई है जिनके नाम बदले गए हैं या जिनमें आस-पास की जगहें खोजने की सुविधा (नया वर्शन) के लिए बदलाव किए गए हैं. इसमें उन पैरामीटर की सूची भी दी गई है जो अब काम नहीं करते.
मौजूदा पैरामीटर |
नया पैरामीटर |
नोट |
keyword |
|
समर्थित नहीं. इसके बजाय, टेक्स्ट खोज (नया) का इस्तेमाल करें. |
language |
languageCode |
|
location |
locationRestriction |
ज़रूरी है. |
maxprice/minprice |
|
समर्थित नहीं. |
|
maxResultCount |
नया पैरामीटर. |
opennow |
|
समर्थित नहीं. |
pagetoken |
|
समर्थित नहीं. |
radius |
|
अब locationRestriction का इस्तेमाल करें. |
rankby |
rankPreference |
|
|
regionCode |
नया पैरामीटर. |
type |
includedTypes
excludedTypes
includedPrimaryTypes
excludedPrimaryTypes
|
नए पैरामीटर, कई तरह की वैल्यू भी स्वीकार करते हैं. लेगसी एपीआई सिर्फ़ एक वैल्यू स्वीकार करता है. |
अनुरोध का उदाहरण
नीचे दिए गए उदाहरण में, GET अनुरोध के लिए Nearby Search (लेगसी) का इस्तेमाल किया गया है. इस उदाहरण में, आपने restaurant
टाइप की जगहों के बारे में जानकारी देने वाले JSON रिस्पॉन्स का अनुरोध किया है. साथ ही, सभी पैरामीटर को यूआरएल पैरामीटर के तौर पर पास किया है:
curl -L -X GET \
'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.7937%2C-122.3965&radius=500&type=restaurant&key=API_KEY'
Nearby Search (नया) की मदद से, POST अनुरोध किया जाता है. साथ ही, सभी पैरामीटर को JSON अनुरोध के मुख्य हिस्से में या POST अनुरोध के हिस्से के तौर पर हेडर में पास किया जाता है.
इस उदाहरण में फ़ील्ड मास्क का भी इस्तेमाल किया गया है, ताकि जवाब में सिर्फ़ जगह का डिसप्ले नेम और फ़ॉर्मैट किया गया पता शामिल हो:
curl -X POST -d '{
"includedTypes": ["restaurant"],
"locationRestriction": {
"circle": {
"center": {
"latitude": 37.7937,
"longitude": -122.3965},
"radius": 500.0
}
}
}' \
-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:searchNearby
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-29 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-29 (UTC) को अपडेट किया गया."],[],[],null,["# Migrate to Nearby 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 supports\n[Nearby Search (Legacy)](/maps/documentation/places/web-service/search-nearby).\nIf you are familiar with Nearby Search (Legacy), the [Nearby Search (New)](/maps/documentation/places/web-service/nearby-search) makes the following\nchanges:\n\n- Nearby 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 Nearby 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/nearby-search#fieldmask).\n- Nearby Search (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 Nearby Search (New).\n- All requests that include a text query should now use [Text Search (New)](/maps/documentation/places/web-service/text-search) because Nearby Search (New) does not support text input.\n- The JSON response format for Nearby 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 Nearby Search (Legacy) that have been\nrenamed or modified for Nearby Search (New), or parameters that are no\nlonger supported.\n\n| Current parameter | New parameter | Notes |\n|---------------------|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| `keyword` | | Not supported. Use [Text Search (New)](/maps/documentation/places/web-service/text-search) instead. |\n| `language` | `languageCode` | |\n| `location` | `locationRestriction` | Required. |\n| `maxprice/minprice` | | Not supported. |\n| | `maxResultCount` | New parameter. |\n| `opennow` | | Not supported. |\n| `pagetoken` | | Not supported. |\n| `radius` | | Use `locationRestriction` now. |\n| `rankby` | `rankPreference` | |\n| | `regionCode` | New parameter. |\n| `type` | `includedTypes` `excludedTypes` `includedPrimaryTypes` `excludedPrimaryTypes` | The new parameters also accept multiple type values. The legacy API only accepts a single value. |\n\nExample request\n---------------\n\nThe following example GET request uses the Nearby Search (Legacy). In this\nexample, you request a JSON response containing information about places of type\n`restaurant` and pass all parameters as URL parameters: \n\n```curl\ncurl -L -X GET \\\n'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.7937%2C-122.3965&radius=500&type=restaurant&key=API_KEY'\n```\n\nWith Nearby Search (New), you make a POST request and pass all\nparameters in the JSON request body or in headers as part of the POST request.\nThis example also uses a field mask so the response only includes the display\nname and formatted address of the place: \n\n```curl\ncurl -X POST -d '{\n \"includedTypes\": [\"restaurant\"],\n \"locationRestriction\": {\n \"circle\": {\n \"center\": {\n \"latitude\": 37.7937,\n \"longitude\": -122.3965},\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: places.displayName,places.formattedAddress\" \\\nhttps://places.googleapis.com/v1/places:searchNearby\n```"]]