Skip to main content

Township Services

All services related to townships are listed in this page.

GET Township List

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

Path: /api/v1/oms/townships/

Query Parameters

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

ParameterData TypeInDescription
tokenstringheaderThe API key of the customer account

Example Request

To get a list of all townships, a GET request should be sent to the /api/v1/oms/townships/ 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:

import requests

url = "https://{domain_url}/api/v1/oms/townships/"
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 townships in a JSON format. The response body contains a JSON object with the townships and their associated attributes, which may include ID, name, city ID, etc.

These attributes are described in the following table.

ParameterData TypeDescription
pkintegerThe ID of the township
namestringThe name of the township
cityintegerThe city ID of the township
is_activebooleanThe status of the township
latitudedecimalThe latitude value of the township
longitudedecimalThe longitude value of the township

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

{
"count": 999,
"next": "https://{domain_url}/api/v1/oms/townships/?page=2",
"previous": null,
"results": [
{
"pk": 1,
"name": "19 MAYIS",
"city": 67,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 2,
"name": "ABANA",
"city": 46,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 3,
"name": "ACIGÖL",
"city": 61,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 4,
"name": "ACIPAYAM",
"city": 25,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 5,
"name": "ADAKLI",
"city": 17,
"is_active": true,
"longitude": "40.48280300",
"latitude": "39.22879700"
},
{
"pk": 6,
"name": "ADALAR",
"city": 40,
"is_active": true,
"longitude": "29.12667800",
"latitude": "40.87392200"
},
{
"pk": 7,
"name": "ADAPAZARI",
"city": 66,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 8,
"name": "ADİLCEVAZ",
"city": 18,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 9,
"name": "AFŞİN",
"city": 42,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 10,
"name": "AĞAÇÖREN",
"city": 5,
"is_active": true,
"longitude": null,
"latitude": null
}
]
}

GET Township List - Simple

This method retrieves a list of townships with detailed information.

Path: /api/v1/oms/townships/list-simple/

Query Parameters

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

ParameterData TypeInDescription
tokenstringheaderThe API key of the customer account

Example Request

To get a detailed list of all townships, a GET request should be sent to the /api/v1/oms/townships/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:

import requests

url = "https://{domain_url}/api/v1/oms/townships/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 townships in a JSON format. The response body contains a JSON object with the townships and their associated attributes, which may include ID, name, created_date, modified_date, etc.

These attributes are described in the following table.

ParameterData TypeDescription
idintegerThe ID of the township
created_datedateThe creation date of the township
modified_datedateThe last modified date of the township
omnitron_idintegerThe Omnitron ID of the township
namestringThe name of the township
cityintegerThe city ID of the township
is_activebooleanThe status of the township
latitudedecimalThe latitude value of the township
longitudedecimalThe longitude value of the township
mappingjsonThe mapped values of the township

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

{
"count": 973,
"next": "https://{domain_url}/api/v1/oms/townships/list-simple/?page=2",
"previous": null,
"results": [
{
"id": 824,
"created_date": "2021-07-06T13:35:13.308537Z",
"modified_date": "2021-07-06T13:35:13.308559Z",
"omnitron_id": 808,
"mapping": null,
"is_active": true,
"name": "19 MAYIS",
"longitude": null,
"latitude": null,
"city": 67
},
{
"id": 567,
"created_date": "2021-07-06T09:51:36.063591Z",
"modified_date": "2021-07-06T09:51:36.063618Z",
"omnitron_id": 548,
"mapping": null,
"is_active": true,
"name": "ABANA",
"longitude": null,
"latitude": null,
"city": 46
},
{
"id": 747,
"created_date": "2021-07-06T10:14:52.423761Z",
"modified_date": "2021-07-06T10:14:52.423786Z",
"omnitron_id": 740,
"mapping": null,
"is_active": true,
"name": "ACIGÖL",
"longitude": null,
"latitude": null,
"city": 61
},
{
"id": 291,
"created_date": "2021-07-06T09:14:07.200301Z",
"modified_date": "2021-07-06T09:14:07.200324Z",
"omnitron_id": 273,
"mapping": null,
"is_active": true,
"name": "ACIPAYAM",
"longitude": null,
"latitude": null,
"city": 25
},
{
"id": 190,
"created_date": "2021-07-06T09:11:50.101556Z",
"modified_date": "2021-09-14T14:04:23.735193Z",
"omnitron_id": 183,
"mapping": null,
"is_active": true,
"name": "ADAKLI",
"longitude": "40.48280300",
"latitude": "39.22879700",
"city": 17
},
{
"id": 486,
"created_date": "2021-07-06T09:49:02.373657Z",
"modified_date": "2021-07-13T08:06:37.371585Z",
"omnitron_id": 448,
"mapping": null,
"is_active": true,
"name": "ADALAR",
"longitude": "29.12667800",
"latitude": "40.87392200",
"city": 40
},
{
"id": 807,
"created_date": "2021-07-06T13:34:52.355525Z",
"modified_date": "2021-07-06T13:34:52.355546Z",
"omnitron_id": 792,
"mapping": null,
"is_active": true,
"name": "ADAPAZARI",
"longitude": null,
"latitude": null,
"city": 66
},
{
"id": 197,
"created_date": "2021-07-06T09:12:04.769071Z",
"modified_date": "2021-07-06T09:12:04.769096Z",
"omnitron_id": 191,
"mapping": null,
"is_active": true,
"name": "ADİLCEVAZ",
"longitude": null,
"latitude": null,
"city": 18
},
{
"id": 527,
"created_date": "2021-07-06T09:49:43.543845Z",
"modified_date": "2021-07-06T09:49:43.543869Z",
"omnitron_id": 517,
"mapping": null,
"is_active": true,
"name": "AFŞİN",
"longitude": null,
"latitude": null,
"city": 42
},
{
"id": 58,
"created_date": "2021-07-06T09:08:40.126374Z",
"modified_date": "2021-07-06T09:08:40.126400Z",
"omnitron_id": 51,
"mapping": null,
"is_active": true,
"name": "AĞAÇÖREN",
"longitude": null,
"latitude": null,
"city": 5
}
]
}