{
"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"
},
...
],
}
}
Avec ce point de terminaison facile à utiliser, vous obtiendrez une liste des codes postaux qui se trouvent à une distance donnée. L'exemple de demande renverra une liste de codes postaux uniques, une liste complète des codes postaux et les détails de chaque code postal.
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&distance=25&zipcode=10005&country=us
Notre API accepte les mesures de distance en kilomètres (par défaut) ou en miles.
Pour changer la mesure en kilomètres vous devez mettre le ms
dans votre requête :
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&ms=km&distance=25&zipcode=10005&country=us
La réponse ressemblera à ceci :
{
"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"
},
...
],
}
}
L'exemple suivant renverra les détails des codes postaux qui correspondent à la requête de recherche.
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&zipcode=10005&country=us
La réponse ressemblera à ceci :
{
"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"
}
],
}
}
Vous pouvez passer des paramètres supplémentaires pour obtenir uniquement ce dont vous avez besoin dans les résultats, ajoutez simplement les fields
valeur dans votre demande.
GET https://postalcodes.app/api/v1/?key=YOUR-APIKEY&fields=["range_codes_unique"]&distance=25&zipcode=10005&country=us
La réponse ressemblera à ceci :
{
"query":{
"code": "10005",
"country": "US",
"range": "25",
"measure": "mi"
},
"results":{
"range_codes_unique": ["07010", "07020", "07022", "07024", "07026", ...]
}
}