Skip to content

Retrieving towns by postcode

Description

Retrieving towns by postcode. Only a part of the code can be specified.

URL structure

GET /v2/references/towns/by/postcode

List of parameters

Name Description Parameter transfer type Required(+)/Default(value)
language Localization language. Usage details. Query string parameter ru
areaIds Additionally: array of region IDs. Use restriction: this parameter is taken into account only if at least one value is specified in the countrySigns parameter. Effect: the fetch will contain only the towns whose regions are specified as the value of this parameter. Query string parameter
countrySigns Additionally: array of country codes in the format ISO 3166-1 alpha-2. Effect: the fetch will contain only the towns whose countries are specified as the value of this parameter. Query string parameter
excludeCountrySigns Additionally: array of country codes in the format ISO 3166-1 alpha-2. Use restriction: this parameter is taken into account only if no value is specified in the countrySigns parameter. Effect: the fetch will contain only the towns whose countries are not specified as the value of this parameter. Query string parameter
limit The desired number of towns, the maximum is 100. A town comes as a separate entry for each matching postcode, so there may be more entries. Query string parameter 10
query Postcode or part of a postcode, the minimum of symbols is 3. Query string parameter +

Result

Array of structures "Town".

Samples of requests and responses

query
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns/by/postcode?language=uk&query=001"
[
    {
        "id": 2791,
        "name": "Єреван",
        "countrySign": "AM",
        "areaId": 0,
        "lat": 40.17765,
        "lon": 44.50532,
        ...
    },
    {
        "id": 5496,
        "name": "Лідо-ді-Остія",
        "countrySign": "IT",
        "areaId": 0,
        "lat": 41.732715,
        "lon": 12.276943,
        ...
    },
    {
        "id": 112928,
        "name": "Катовіце",
        "countrySign": "PL",
        "areaId": 158,
        "lat": 50.259899,
        "lon": 19.021585,
        ...
    },
    {
        "id": 113124,
        "name": "Хлюдово",
        "countrySign": "PL",
        "areaId": 161,
        "lat": 52.555771,
        "lon": 16.844781,
        ...
    },
    {
        "id": 113127,
        "name": "Тшебовниско",
        "countrySign": "PL",
        "areaId": 155,
        "lat": 50.078002,
        "lon": 22.036459,
        ...
    },
    {
        "id": 113206,
        "name": "Дывиты",
        "countrySign": "PL",
        "areaId": 160,
        "lat": 53.83404,
        "lon": 20.47337,
        ...
    },
    {
        "id": 110187,
        "name": "Торренова",
        "countrySign": "IT",
        "areaId": 0,
        "lat": 41.879132,
        "lon": 12.616869,
        ...
    }
]
query + countrySigns
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns/by/postcode?language=uk&query=001&countrySigns=PL"
[
    {
        "id": 112928,
        "name": "Катовіце",
        "countrySign": "PL",
        "areaId": 158,
        "lat": 50.259899,
        "lon": 19.021585,
        ...
    },
    {
        "id": 113124,
        "name": "Хлюдово",
        "countrySign": "PL",
        "areaId": 161,
        "lat": 52.555771,
        "lon": 16.844781,
        ...
    },
    {
        "id": 113127,
        "name": "Тшебовниско",
        "countrySign": "PL",
        "areaId": 155,
        "lat": 50.078002,
        "lon": 22.036459,
        ...
    },
    {
        "id": 113206,
        "name": "Дывиты",
        "countrySign": "PL",
        "areaId": 160,
        "lat": 53.83404,
        "lon": 20.47337,
        ...
    }
]
query + countrySigns + areaIds
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns/by/postcode?language=uk&query=001&countrySigns=PL&areaIds=160,161"
[
    {
        "id": 113124,
        "name": "Хлюдово",
        "countrySign": "PL",
        "areaId": 161,
        "lat": 52.555771,
        "lon": 16.844781,
        ...
    },
    {
        "id": 113206,
        "name": "Дывиты",
        "countrySign": "PL",
        "areaId": 160,
        "lat": 53.83404,
        "lon": 20.47337,
        ...
    }
]
query + excludeCountrySigns
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns/by/postcode?language=uk&query=001&excludeCountrySigns=AM,PL"
[
    {
        "id": 5496,
        "name": "Лідо-ді-Остія",
        "countrySign": "IT",
        "areaId": 0,
        "lat": 41.732715,
        "lon": 12.276943,
        ...
    },
    {
        "id": 110187,
        "name": "Торренова",
        "countrySign": "IT",
        "areaId": 0,
        "lat": 41.879132,
        "lon": 12.616869,
        ...
    }
]