{
"query":{
"code": "10005",
"country": "US",
"range": "25",
"measure": "mi",
},
"results":{
"range_codes_unique": [
"07010",
"07020",
"07022",
"07024",
"07026",
...
],
"range_codes": [
"07010",
"07020",
"07022",
"07024",
"07026",
...
],
"range_codes_details": [
{
"postal_code":"07010",
"country_code":"US",
"city":"Cliffside Park",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07020",
"country_code":"US",
"city":"Edgewater",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07022",
"country_code":"US",
"city":"Fairview",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07024",
"country_code":"US",
"city":"Fort Lee",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07026",
"country_code":"US",
"city":"Garfield",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
...
],
}
}
この使いやすいエンドポイントを使用すると、特定の距離内にある郵便番号のリストを取得できます。リクエストの例では、一意の郵便番号のリスト、郵便番号の完全なリスト、および各郵便番号の詳細が返されます。
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&distance=25&zipcode=10005&country=us
APIは、キロメートル(デフォルト)またはマイルでの距離測定を受け入れます。
測定値をキロメートルに変更するには、リクエストにms
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&ms=km&distance=25&zipcode=10005&country=us
応答は次のようになります。
{
"query":{
"code": "10005",
"country": "US",
"range": "25",
"measure": "mi"
},
"results":{
"range_codes_unique": ["07010", "07020", "07022", "07024", "07026", ...],
"range_codes": ["07010", "07020", "07022", "07024", "07026", ...],
"range_codes_details": [
{
"postal_code":"07010",
"country_code":"US",
"city":"Cliffside Park",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07020",
"country_code":"US",
"city":"Edgewater",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07022",
"country_code":"US",
"city":"Fairview",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07024",
"country_code":"US",
"city":"Fort Lee",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
{
"postal_code":"07026",
"country_code":"US",
"city":"Garfield",
"state":"New Jersey",
"state_code":"NJ",
"province":"Bergen",
"province_code":"003"
},
...
],
}
}
次の例では、検索クエリに一致する郵便番号の詳細が返されます。
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&zipcode=10005&country=us
応答は次のようになります。
{
"query":{
"code": "10005",
"country": "us",
"range": "",
"measure": "mi"
},
"results":{
"range_codes_unique": ["10005"],
"range_codes": ["10005"],
"range_codes_details": [
{
"postal_code":"10005",
"country_code":"US",
"city":"New York",
"state":"New York",
"state_code":"NY",
"province":"New York",
"province_code":"061"
}
],
}
}
追加のパラメータを渡して、結果に必要なものだけを取得できます。リクエストにfields
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&fields=["range_codes_unique"]&distance=25&zipcode=10005&country=us
応答は次のようになります。
{
"query":{
"code": "10005",
"country": "US",
"range": "25",
"measure": "mi"
},
"results":{
"range_codes_unique": ["07010", "07020", "07022", "07024", "07026", ...]
}
}