पिन कोड लुकअप

पिन कोड दीजिए, वह जिस जगह का है वह पाइए। 121 देशों को कवर करता है।

GEThttps://api.mygeocode.com/v1/postcode

पैरामीटर

पैरामीटरप्रकारविवरण
codeज़रूरीstringपिन कोड। स्पेस, हाइफ़न और अक्षरों का केस नॉर्मलाइज़ किया जाता है।
countryवैकल्पिकstringISO 3166-1 alpha-2 कोड। इसकी पुरज़ोर सलाह दी जाती है; पिन कोड अलग-अलग देशों में अनोखे नहीं होते। इसके बिना हर मेल खाने वाले देश के परिणाम लौटाए जाते हैं, सबसे अधिक आबादी वाले पहले।
keyवैकल्पिकstringAPI कुंजी, अगर हेडर के रूप में नहीं भेजी गई।

उदाहरण

$ curl -H "X-API-Key: YOUR_KEY" "https://api.mygeocode.com/v1/postcode?code=75008&country=fr"
const url = new URL("https://api.mygeocode.com/v1/postcode");
url.searchParams.set("code", "75008");
url.searchParams.set("country", "fr");

const { results } = await (await fetch(url, { headers: { "X-API-Key": "YOUR_KEY" } })).json();
console.log(results[0].place, results[0].lat, results[0].lon);
import requests

r = requests.get("https://api.mygeocode.com/v1/postcode", params={"code": "75008", "country": "fr"}, headers={"X-API-Key": "YOUR_KEY"}, timeout=5)
first = r.json()["results"][0]
print(first["place"], first["lat"], first["lon"])
रिस्पॉन्स
{
  "status": "ok",
  "postcode": "75008",
  "country_code": "FR",
  "results": [
    {
      "postcode": "75008",
      "place": "Paris",
      "region": "Île-de-France",
      "region_code": null,
      "country": "France",
      "country_code": "FR",
      "lat": 48.853402,
      "lon": 2.348799
    },
    {
      "postcode": "75008",
      "place": "Paris 08",
      "region": "Île-de-France",
      "region_code": null,
      "country": "France",
      "country_code": "FR",
      "lat": 48.876299,
      "lon": 2.318299
    }
  ]
}

रिस्पॉन्स फ़ील्ड

फ़ील्डप्रकारविवरण
postcodestringनॉर्मलाइज़ेशन के बाद का कोड।
country_codestring या nullलागू किया गया देश फ़िल्टर, अगर कोई हो।
resultsarrayवे जगहें जिन्हें कोड कवर करता है। आम तौर पर एक; गाँवों तक फैले ग्रामीण कोड के लिए कई। कोड अज्ञात होने पर खाली।
results[].postcodestringकोड, जैसा देश उसे लिखता है: K1A 0B1।
results[].placestringइलाके का नाम, जैसा डाक प्राधिकरण उपयोग करता है।
results[].region, region_codestringपहले स्तर का प्रशासनिक विभाग और उसका ISO 3166-2 प्रत्यय (जहाँ कोई न हो वहाँ region_code null होता है)।
results[].country, country_codestringदेश का नाम और बड़े अक्षरों में ISO 3166-1 alpha-2 कोड।
results[].lat, lonnumberजहाँ प्रकाशित हो वहाँ डाक प्राधिकरण का बिंदु, अन्यथा कोड के पतों का केंद्रबिंदु।

टिप्पणियाँ

एरर

400 invalid_request जब code खाली हो या 16 अक्षरों से लंबा हो, या country मान्य alpha-2 कोड न हो।