# City Services

All services related to cities are listed in this page.

### `GET` City List

This method returns a list of cities with less detailed information.

**Path:** `/api/v1/oms/cities/`

**Query Parameters**

The following query parameters can be used to get information about cities.

| Parameter | Data Type | In     | Description                         |
| --------- | --------- | ------ | ----------------------------------- |
| token     | string    | header | The API key of the customer account |

**Example Request**

To get a list of all cities, a `GET` request should be sent to the `/api/v1/oms/cities/` endpoint. In the headers, set the `Authorization` header to include the token for authentication.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{domain_url}/api/v1/oms/cities/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Token {token}'
}

response = requests.request('GET', url, headers=headers)

print(response.json())
```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK`, the API returns all the cities in a `JSON` format. The response body contains a JSON object with the cities and their associated attributes, which may include ID, name, country, etc.

These attributes are described in the following table.

| Parameter  | Data Type | Description                     |
| ---------- | --------- | ------------------------------- |
| pk         | integer   | The ID of the city              |
| name       | string    | The name of the city            |
| country    | integer   | The country ID of the city      |
| is\_active | boolean   | The status of the city          |
| latitude   | decimal   | The latitude value of the city  |
| longitude  | decimal   | The longitude value of the city |

This example response serves as a reference to understand the structure and data format returned from this API service.

```json
{
  "count": 81,
  "next": "https://{domain_url}/api/v1/oms/cities/?page=2",
  "previous": null,
  "results": [
    {
      "pk": 1,
      "name": "ADANA",
      "country": 1,
      "is_active": true,
      "longitude": "35.31945700",
      "latitude": "37.00294000"
    },
    {
      "pk": 2,
      "name": "ADIYAMAN",
      "country": 1,
      "is_active": true,
      "longitude": "38.27942400",
      "latitude": "37.76293800"
    },
    {
      "pk": 3,
      "name": "AFYONKARAHİSAR",
      "country": 1,
      "is_active": true,
      "longitude": "30.53876700",
      "latitude": "38.75689100"
    },
    {
      "pk": 4,
      "name": "AĞRI",
      "country": 1,
      "is_active": true,
      "longitude": "43.04948700",
      "latitude": "39.70789900"
    },
    {
      "pk": 5,
      "name": "AKSARAY",
      "country": 1,
      "is_active": true,
      "longitude": "34.02301800",
      "latitude": "38.37125000"
    },
    {
      "pk": 6,
      "name": "AMASYA",
      "country": 1,
      "is_active": true,
      "longitude": "35.82808300",
      "latitude": "40.65117800"
    },
    {
      "pk": 7,
      "name": "ANKARA",
      "country": 1,
      "is_active": true,
      "longitude": "32.85404900",
      "latitude": "39.92076300"
    },
    {
      "pk": 8,
      "name": "ANTALYA",
      "country": 1,
      "is_active": true,
      "longitude": "30.70324900",
      "latitude": "36.88709900"
    },
    {
      "pk": 9,
      "name": "ARDAHAN",
      "country": 1,
      "is_active": true,
      "longitude": null,
      "latitude": null
    },
    {
      "pk": 10,
      "name": "ARTVİN",
      "country": 1,
      "is_active": true,
      "longitude": null,
      "latitude": null
    }
  ]
}
```

### `GET` City List - Detailed

This method retrieves a list of cities with detailed information.

**Path:** `/api/v1/oms/cities/list-simple/`

**Query Parameters**

The following query parameters can be used to get the information about cities.

| Parameter | Data Type | In     | Description                         |
| --------- | --------- | ------ | ----------------------------------- |
| token     | string    | header | The API key of the customer account |

**Example Request**

To get a detailed list of all cities, a `GET` request should be sent to the `/api/v1/oms/cities/list-simple/` endpoint. In the headers, set the `Authorization` header to include the token for authentication.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{domain_url}/api/v1/oms/cities/list-simple/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Token {token}'
}

response = requests.request('GET', url, headers=headers)

print(response.json())
```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK`, the API returns all the cities in a `JSON` format. The response body contains a JSON object with the cities and their associated attributes, which may include ID, name, country, created\_date,\
modified\_date, etc.

These attributes are described in the following table.

| Parameter      | Data Type | Description                        |
| -------------- | --------- | ---------------------------------- |
| id             | integer   | The ID of the city                 |
| created\_date  | date      | The creation date of the city      |
| modified\_date | date      | The last modified date of the city |
| omnitron\_id   | integer   | The Omnitron ID of the city        |
| name           | string    | The name of the city               |
| country        | integer   | The country ID of the city         |
| is\_active     | boolean   | The status of the city             |
| latitude       | decimal   | The latitude value of the city     |
| longitude      | decimal   | The longitude value of the city    |
| mapping        | json      | The mapped values of the city      |

This example response serves as a reference to understand the structure and data format returned from this API service.

```json
{
  "count": 81,
  "next": "https://{domain_url}/api/v1/oms/cities/list-simple/?page=2",
  "previous": null,
  "results": [
    {
      "id": 1,
      "created_date": "2021-07-06T09:07:23.199904Z",
      "modified_date": "2021-07-08T07:45:02.050858Z",
      "omnitron_id": 1,
      "mapping": null,
      "is_active": true,
      "name": "ADANA",
      "longitude": "35.31945700",
      "latitude": "37.00294000",
      "country": 1
    },
    {
      "id": 2,
      "created_date": "2021-07-06T09:07:37.555990Z",
      "modified_date": "2021-07-08T08:11:00.193298Z",
      "omnitron_id": 2,
      "mapping": null,
      "is_active": true,
      "name": "ADIYAMAN",
      "longitude": "38.27942400",
      "latitude": "37.76293800",
      "country": 1
    },
    {
      "id": 3,
      "created_date": "2021-07-06T09:07:58.210581Z",
      "modified_date": "2021-08-19T10:43:05.822467Z",
      "omnitron_id": 3,
      "mapping": null,
      "is_active": true,
      "name": "AFYONKARAHİSAR",
      "longitude": "30.53876700",
      "latitude": "38.75689100",
      "country": 1
    },
    {
      "id": 4,
      "created_date": "2021-07-06T09:08:18.131972Z",
      "modified_date": "2021-10-15T13:32:34.751765Z",
      "omnitron_id": 4,
      "mapping": null,
      "is_active": true,
      "name": "AĞRI",
      "longitude": "43.04948700",
      "latitude": "39.70789900",
      "country": 1
    },
    {
      "id": 5,
      "created_date": "2021-07-06T09:08:33.629586Z",
      "modified_date": "2021-08-19T11:15:12.123820Z",
      "omnitron_id": 5,
      "mapping": null,
      "is_active": true,
      "name": "AKSARAY",
      "longitude": "34.02301800",
      "latitude": "38.37125000",
      "country": 1
    },
    {
      "id": 6,
      "created_date": "2021-07-06T09:08:40.727268Z",
      "modified_date": "2021-09-15T07:54:01.409366Z",
      "omnitron_id": 6,
      "mapping": null,
      "is_active": true,
      "name": "AMASYA",
      "longitude": "35.82808300",
      "latitude": "40.65117800",
      "country": 1
    },
    {
      "id": 7,
      "created_date": "2021-07-06T09:08:53.236809Z",
      "modified_date": "2021-07-09T05:41:43.637325Z",
      "omnitron_id": 7,
      "mapping": null,
      "is_active": true,
      "name": "ANKARA",
      "longitude": "32.85404900",
      "latitude": "39.92076300",
      "country": 1
    },
    {
      "id": 8,
      "created_date": "2021-07-06T09:09:22.402856Z",
      "modified_date": "2021-12-23T07:57:40.705514Z",
      "omnitron_id": 8,
      "mapping": null,
      "is_active": true,
      "name": "ANTALYA",
      "longitude": "30.70324900",
      "latitude": "36.88709900",
      "country": 1
    },
    {
      "id": 9,
      "created_date": "2021-07-06T09:09:41.942917Z",
      "modified_date": "2021-07-06T09:09:41.942941Z",
      "omnitron_id": 9,
      "mapping": null,
      "is_active": true,
      "name": "ARDAHAN",
      "longitude": null,
      "latitude": null,
      "country": 1
    },
    {
      "id": 10,
      "created_date": "2021-07-06T09:09:49.483105Z",
      "modified_date": "2021-07-06T09:09:49.483132Z",
      "omnitron_id": 10,
      "mapping": null,
      "is_active": true,
      "name": "ARTVİN",
      "longitude": null,
      "latitude": null,
      "country": 1
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/oms/city-services.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
