पिन कोड लुकअप

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

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

पैरामीटर

पैरामीटरप्रकारविवरण
codeज़रूरीstringपिन कोड। स्पेस, हाइफ़न और अक्षरों का केस नॉर्मलाइज़ किया जाता है।
countryवैकल्पिकstringISO 3166-1 alpha-2 कोड। इसकी पुरज़ोर सलाह दी जाती है; पिन कोड अलग-अलग देशों में अनोखे नहीं होते। इसके बिना हर मेल खाने वाले देश के परिणाम लौटाए जाते हैं, सबसे अधिक आबादी वाले पहले।
langवैकल्पिकstringजगह और क्षेत्र के नामों के लिए ISO 639-1 कोड। डिफ़ॉल्ट en
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 8e Arrondissement",
      "region": "Ile-de-France",
      "region_code": "IDF",
      "country": "France",
      "country_code": "FR",
      "lat": 48.8727,
      "lon": 2.3125
    }
  ]
}

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

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

टिप्पणियाँ

एरर

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