Skip to content

Список городов

Эндпоинт с помощью которого можно получить список городов.

Метод запроса: GET

bash
https://gateway.spark-dev.team/cabinet/api/v2/cities

Описание параметров запроса:

Наименование параметраТипОбязательный параметр
pageNumberНет
limitNumberНет
countryIdNumberНет

Пример запроса для получения первой страницы городов и ограничением в 20 элементов:

bash
https://gateway.spark-dev.team/cabinet/api/v2/cities?page=1&limit=20

Пример запроса для получения только городов Казахстана

bash
https://gateway.spark-dev.team/cabinet/api/v2/cities?countryId=1
Пример ответа
json
{
    "data": [
        {
            "id": 1,
            "name": "Алматы",
            "region": "Алматинская"
        }
    ],
    "links": {
        "first": "https://cabinetp.spark.kz/api/v2/cities?page=1",
        "last": "https://cabinetp.spark.kz/api/v2/cities?page=2331",
        "prev": null,
        "next": "https://cabinetp.spark.kz/api/v2/cities?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 2331,
        "links": [
            {
                "url": null,
                "label": "pagination.previous",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=4",
                "label": "4",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=5",
                "label": "5",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=6",
                "label": "6",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=7",
                "label": "7",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=8",
                "label": "8",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=9",
                "label": "9",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=10",
                "label": "10",
                "active": false
            },
            {
                "url": null,
                "label": "...",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=2330",
                "label": "2330",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=2331",
                "label": "2331",
                "active": false
            },
            {
                "url": "https://cabinetp.spark.kz/api/v2/cities?page=2",
                "label": "pagination.next",
                "active": false
            }
        ],
        "path": "https://cabinetp.spark.kz/api/v2/cities",
        "per_page": 1,
        "to": 1,
        "total": 2331
    },
    "code": 0,
    "success": true,
    "message": "",
    "errors": []
}