Skip to content

Directory "Towns" (outdated)

Description

Retrieving towns.

This method is outdated. It still works, but we recommend using other methods of retrieving towns instead:

URL structure

GET /v2/references/towns/by/ids

List of parameters

Name Description Parameter transfer type Required(+)/Default(value)
language Localization language. Usage details. Query string parameter ru
ids Additional filtering options. Query string parameter
query Search text. Query string parameter
areaIds Additionally: array of region IDs. Query string parameter
countrySigns Additionally: array of country codes in the format ISO 3166-1 alpha-2. Query string parameter
queryLimit The desired number of responses, the maximum is 100. Query string parameter 10

Request creation specifics

  • The request must contain the ids parameter (?ids=2,4,7) or the query parameter (?query=test)
  • The areaIds parameter only works if the request also contains the countrySigns parameter.

Result

Array of structures "Town".

Sample requests and sample responses

Using the ids parameter

ids
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns?ids=137,138&language=uk"
[
    {
        "id": 137,
        "name": "Київ",
        "countrySign": "UA",
        "areaId": 23,
        "lat": 50.444795,
        "lon": 30.528718,
        "postcode": [
            "01000-06999",
            "12345"
        ]
    },
    {
        "id": 138,
        "name": "Васильків",
        "countrySign": "UA",
        "areaId": 23,
        "lat": 50.177089,
        "lon": 30.319639,
        "postcode": [
            "08600-08606"
        ]
    }
]

Using the query parameter

query + countrySigns + queryLimit
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns?query=kras&countrySigns=UA,RU&queryLimit=5&language=uk"
[
    {
        "id": 1511,
        "name": "Красноярськ",
        "countrySign": "RU",
        "areaId": 74,
        "lat": 56.008711,
        "lon": 92.870412,
        "postcode": [
            "660000"
        ]
    },
    {
        "id": 578,
        "name": "Краснодар",
        "countrySign": "RU",
        "areaId": 73,
        "lat": 45.034942,
        "lon": 38.976032
    },
    {
        "id": 89,
        "name": "Красноперекопськ",
        "countrySign": "UA",
        "areaId": 25,
        "lat": 45.952198,
        "lon": 33.795077,
        "postcode": [
            "96000-96005"
        ]
    },
    {
        "id": 4337,
        "name": "Краснопілля",
        "countrySign": "UA",
        "areaId": 32,
        "lat": 50.767108,
        "lon": 35.267666,
        "postcode": [
            "42400"
        ]
    },
    {
        "id": 6529,
        "name": "Краснокутськ",
        "countrySign": "UA",
        "areaId": 34,
        "lat": 50.055979,
        "lon": 35.147628
    }
]
query + countrySigns + areaIds
curl -X GET -H "Accept: application/json" -H "Authorization: 3WQ1EQ465C4005000130" "https://api.lardi-trans.com/v2/references/towns?query=kras&areaIds=73,32,34&countrySigns=UA,RU&language=uk"
[
    {
        "id": 578,
        "name": "Краснодар",
        "countrySign": "RU",
        "areaId": 73,
        "lat": 45.034942,
        "lon": 38.976032
    },
    {
        "id": 4337,
        "name": "Краснопілля",
        "countrySign": "UA",
        "areaId": 32,
        "lat": 50.767108,
        "lon": 35.267666,
        "postcode": [
            "42400"
        ]
    },
    {
        "id": 6529,
        "name": "Краснокутськ",
        "countrySign": "UA",
        "areaId": 34,
        "lat": 50.055979,
        "lon": 35.147628
    },
    {
        "id": 72,
        "name": "Красноград",
        "countrySign": "UA",
        "areaId": 34,
        "lat": 49.373049,
        "lon": 35.461353,
        "postcode": [
            "63300"
        ]
    },
    {
        "id": 68,
        "name": "Краснопавлівка",
        "countrySign": "UA",
        "areaId": 34,
        "lat": 49.137419,
        "lon": 36.3239,
        "postcode": [
            "64622"
        ]
    },
    {
        "id": 131706,
        "name": "Краснопавлівське",
        "countrySign": "UA",
        "areaId": 34,
        "lat": 49.21291,
        "lon": 36.297798,
        "postcode": [
            "64143"
        ]
    },
    {
        "id": 122810,
        "name": "Красне Перше",
        "countrySign": "UA",
        "areaId": 34,
        "lat": 49.943676,
        "lon": 37.755707,
        "postcode": [
            "62710"
        ]
    },
    {
        "id": 122808,
        "name": "Красне",
        "countrySign": "UA",
        "areaId": 32,
        "lat": 51.319538,
        "lon": 33.727001,
        "postcode": [
            "41507"
        ]
    },
    {
        "id": 122867,
        "name": "Красичка",
        "countrySign": "UA",
        "areaId": 32,
        "lat": 52.186432,
        "lon": 33.759609,
        "postcode": [
            "41034"
        ]
    },
    {
        "id": 8150,
        "name": "Красна Поляна",
        "countrySign": "RU",
        "areaId": 73,
        "lat": 45.356751,
        "lon": 40.863563
    }
]