District Services
All services related to districts are listed in this page.
GET
District List
This method returns a list of districts with less detailed information.
Path: /api/v1/oms/districts/
Query Parameters
The following query parameters can be used to get the information about districts.
Parameter | Data Type | In | Description |
---|---|---|---|
token | string | header | The API key of the customer account |
Example Request
To get a list of all districts, a GET
request should be sent to the /api/v1/oms/districts/
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/districts/"
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 districts in a JSON format. The response body contains a JSON object with the districts and their associated attributes, which may include ID, name, city ID, township ID, etc.
These attributes are described in the following table.
Parameter | Data Type | Description |
---|---|---|
pk | integer | The ID of the district |
name | string | The name of the district |
city | integer | The city ID of the district |
township | integer | The township ID of the district |
is_active | boolean | The status of the district |
latitude | decimal | The latitude value of the district |
longitude | decimal | The longitude value of the district |
This example response serves as a reference to understand the structure and data format returned from this API service.
{
"count": 73256,
"next": "https://{domain_url}/api/v1/oms/districts/?page=2",
"previous": null,
"results": [
{
"pk": 66377,
"name": "100. YIL MAH",
"city": 74,
"township": 890,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 65943,
"name": "100. YIL MAH",
"city": 73,
"township": 879,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 48800,
"name": "100. YIL MAH",
"city": 54,
"township": 659,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 36064,
"name": "100. YIL MAH",
"city": 40,
"township": 482,
"is_active": true,
"longitude": "28.85152400",
"latitude": "41.06363300"
},
{
"pk": 10940,
"name": "100.YIL MAH",
"city": 12,
"township": 151,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 44603,
"name": "100.YIL MAH",
"city": 47,
"township": 569,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 5535,
"name": "100.YIL MAH",
"city": 7,
"township": 71,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 11307,
"name": "100.YIL MAH",
"city": 12,
"township": 158,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 3568,
"name": "100.YIL MAH",
"city": 4,
"township": 46,
"is_active": true,
"longitude": null,
"latitude": null
},
{
"pk": 38862,
"name": "100.YIL MAH",
"city": 43,
"township": 531,
"is_active": true,
"longitude": null,
"latitude": null
}
]
}
GET
District List - Detailed
This method retrieves a list of districts with detailed information.
Path: /api/v1/oms/districts/list-simple/
Query Parameters
The following query parameters can be used to get the information about districts.
Parameter | Data Type | In | Description |
---|---|---|---|
token | string | header | The API key of the customer account |
Example Request
To get a detailed list of all districts, a GET
request should be sent to the /api/v1/oms/districts/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/districts/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 districts in a JSON
format. The response body contains a JSON object with the districts and their associated attributes, which may include ID, name, created_date, modified_date, etc.
These attributes are described in the following table.
Parameter | Data Type | Description |
---|---|---|
id | integer | The ID of the district |
created_date | date | The creation date of the district |
modified_date | date | The last modified date of the district |
omnitron_id | integer | The Omnitron ID of the district |
name | string | The name of the district |
city | integer | The city ID of the district |
township | integer | The township ID of the district |
is_active | boolean | The status of the district |
latitude | decimal | The latitude value of the district |
longitude | decimal | The longitude value of the district |
mapping | json | The mapped values of the district |
This example response serves as a reference to understand the structure and data format returned from this API service.
{
"count": 73256,
"next": "https://{domain_url}/api/v1/oms/districts/list-simple/?page=2",
"previous": null,
"results": [
{
"id": 66377,
"created_date": "2021-07-06T13:36:59.785704Z",
"modified_date": "2021-07-06T13:36:59.785724Z",
"omnitron_id": 67480,
"mapping": null,
"is_active": true,
"name": "100. YIL MAH",
"longitude": null,
"latitude": null,
"city": 74,
"township": 890
},
{
"id": 65943,
"created_date": "2021-07-06T13:36:53.051853Z",
"modified_date": "2021-07-06T13:36:53.051873Z",
"omnitron_id": 66079,
"mapping": null,
"is_active": true,
"name": "100. YIL MAH",
"longitude": null,
"latitude": null,
"city": 73,
"township": 879
},
{
"id": 48800,
"created_date": "2021-07-06T10:01:43.943160Z",
"modified_date": "2021-07-06T10:01:43.943184Z",
"omnitron_id": 48646,
"mapping": null,
"is_active": true,
"name": "100. YIL MAH",
"longitude": null,
"latitude": null,
"city": 54,
"township": 659
},
{
"id": 36064,
"created_date": "2021-07-06T09:49:00.464080Z",
"modified_date": "2021-07-13T09:37:45.978120Z",
"omnitron_id": 35247,
"mapping": null,
"is_active": true,
"name": "100. YIL MAH",
"longitude": "28.85152400",
"latitude": "41.06363300",
"city": 40,
"township": 482
},
{
"id": 10940,
"created_date": "2021-07-06T09:10:44.004277Z",
"modified_date": "2021-07-06T09:10:44.004300Z",
"omnitron_id": 10897,
"mapping": null,
"is_active": true,
"name": "100.YIL MAH",
"longitude": null,
"latitude": null,
"city": 12,
"township": 151
},
{
"id": 44603,
"created_date": "2021-07-06T09:51:39.526557Z",
"modified_date": "2021-07-06T09:51:39.526583Z",
"omnitron_id": 45153,
"mapping": null,
"is_active": true,
"name": "100.YIL MAH",
"longitude": null,
"latitude": null,
"city": 47,
"township": 569
},
{
"id": 5535,
"created_date": "2021-07-06T09:09:01.877156Z",
"modified_date": "2021-07-06T09:09:01.877182Z",
"omnitron_id": 6196,
"mapping": null,
"is_active": true,
"name": "100.YIL MAH",
"longitude": null,
"latitude": null,
"city": 7,
"township": 71
},
{
"id": 11307,
"created_date": "2021-07-06T09:10:50.613473Z",
"modified_date": "2021-07-06T09:10:50.613497Z",
"omnitron_id": 10530,
"mapping": null,
"is_active": true,
"name": "100.YIL MAH",
"longitude": null,
"latitude": null,
"city": 12,
"township": 158
},
{
"id": 3568,
"created_date": "2021-07-06T09:08:26.777622Z",
"modified_date": "2021-07-06T09:08:26.777654Z",
"omnitron_id": 3520,
"mapping": null,
"is_active": true,
"name": "100.YIL MAH",
"longitude": null,
"latitude": null,
"city": 4,
"township": 46
},
{
"id": 38862,
"created_date": "2021-07-06T09:49:54.925907Z",
"modified_date": "2021-07-06T09:49:54.925932Z",
"omnitron_id": 38572,
"mapping": null,
"is_active": true,
"name": "100.YIL MAH",
"longitude": null,
"latitude": null,
"city": 43,
"township": 531
}
]
}