Cities special request

Although every existing endpoint in the API has params requests to get specific data, as well as limit, offset and params, for Cities there are special requests by using the request param params: attribute used to obtain additional data needed.

The attributes that are used for special requests are listed below:

  • Country.
  • Administrator.
  • Options.

Country

This param is used to obtain the Country for the cities with the country attribute.

An example to use this param is:

  • http://apiv4.ordering.co/v400/en/demo/countries/1/cities?params=country,country_id

🚧

The param country_id is required when country is used.

[
    {
        "id": 1,
        "country_id": 1,
        "country": {
            "id": 1,
            "name": "United States",
            "enabled": true
        },
        "administrator": null
    },
    {
        "id": 2,
        "country_id": 1,
        "country": {
            "id": 1,
            "name": "United States",
            "enabled": true
        },
        "administrator": null
    },
  	... //if findAll
]

Administrator

This param is used to obtain the user administrator for the cities with the administrator attribute.

An example to use this param is:

  • http://apiv4.ordering.co/v400/en/demo/countries/1/cities?params=administrator_id,administrator

🚧

The param administrator_id is required when administrator is used.

[
    {
        "id": 1,
        "administrator_id": 4,
        "administrator": {
            "id": 4,
            "name": "City",
            "lastname": "",
            "email": "[email protected]",
            "login_type": 0,
            "social_id": null,
            "photo": null,
            "birthdate": null,
            "phone": "",
            "cellphone": "",
            "city_id": null,
            "dropdown_option_id": null,
            "address": "5th avenue",
            "address_notes": null,
            "zipcode": "",
            "location": {
                "lat": 40.774734,
                "lng": -73.9653844,
                "zipcode": -1,
                "zoom": 15
            },
            "level": 1,
            "language_id": 1,
            "push_notifications": true,
            "busy": false,
            "available": false,
            "enabled": true,
            "created_at": "2018-07-02 18:04:00",
            "updated_at": "2018-07-02 18:04:00",
            "deleted_at": null
        }
    },
    ... //if findAll
]

Options

This param is used to obtain the dropdown options for that city with the options.

An example to use this param is:

  • http://apiv4.ordering.co/v400/en/demo/countries/1/cities?params=options
{
    "error": false,
    "result": [
        {
            "id": 1,
            "name": "New York",
            "country_id": 1,
            "administrator_id": 6,
            "enabled": true,
            "options": [
                {
                    "id": 1,
                    "city_id": 1,
                    "name": "New York downtown",
                    "enabled": true
                }
            ]
        },
        {
            "id": 2,
            "name": "San Francisco",
            "country_id": 1,
            "administrator_id": 4,
            "enabled": true,
            "options": []
        },
        {
            "id": 3,
            "name": "Austin",
            "country_id": 1,
            "administrator_id": 4,
            "enabled": true,
            "options": []
        }
    ]
}