Cities

Cities

Access to cities is provided to all users who have the appropriate permission in their personal account.
For getting information about cities, the following requests are provided:

The list method allows you to get a list of the cities

Request:

{site_path}/{lang}/api/city/list

GET parameters list:

filter array Allows filtering data by all available fields
fields string Allows to select only the specified fields from all available
sort string Allows you to sort asc and desc entities by all available fields
page int Allows you to pass the page number of the list of entities

List of all available fields

id int City ID
name string City name
countryID int ID Country
regionID int ID Region

Response

The response is transmitted in JSON format. List of response fields:

result array List of cities based on query parameters
_links array List of navigation links. May contain the following elements:
  • self - contains a link to the current page of the list
  • first - contains a link to the first page of the list
  • last - contains a link to the last page of the list
  • prev - contains a link to the previous page of the list
  • next - contains a link to the next page of the list
_meta array Information on list navigation. Contains elements:
  • totalCount - total number of available entities considering all selected parameters
  • pageCount - the sequence number of the entity in the list that starts the current page
  • currentPage - number of the current page
  • perPage - number of entities displayed on one page

Request example:

{site_path}/{lang}/api/city/list?filter[id][in][]=1&filter[id][in][]=2&filter[id][in][]=3&sort=name

Response example:

{
  "result": [
    {
      "id": 18918,
      "name": "Protaras",
      "countryID": 34,
      "regionID": 88
    },
    {
      "id": 32767,
      "name": "Qarc",
      "countryID": 28,
      "regionID": 59
    },
    {
      "id": 5819,
      "name": "Souni",
      "countryID": 34,
      "regionID": 1
    }
  ],
  "_links": {
    "self": {
      "href": "{site_path}/{lang}/api/city/list?filter%5Bid%5D%5Bin%5D%5B0%5D=5819&filter%5Bid%5D%5Bin%5D%5B1%5D=18918&filter%5Bid%5D%5Bin%5D%5B2%5D=32767&sort=name&page=1"
    }
  },
  "_meta": {
    "totalCount": 3,
    "pageCount": 1,
    "currentPage": 1,
    "perPage": 20
  }
}