# Address Setup Services

All services related to address setup are listed in this page.

### `POST` Execute

This endpoint is used for adding countries, cities, townships, and districts that exist in Omnitron but are not currently present in the OMS database.

**Path:** `/api/v1/oms/setup/addresses/execute/`

**Request Body**

The following query parameters can be used to execute the setup.

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

**Example Request**

To execute this setup step, a `POST` request should be sent to the `/api/v1/oms/setup/addresses/execute/` 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/setup/addresses/execute/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.status_code)

```

**Response 204 No Content**

There is No Response.

### `GET` Get Async Status

This endpoint provides the status of the task executed by the "execute" endpoint. If there is no active task, the result will be returned as "READY."

**Path:** `/api/v1/oms/setup/addresses/get_async_status/`

**Request Body**

The following query parameters can be used to view the status of the setup task.

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

**Example Request**

To view the status of the task, a `GET` request should be sent to the `/api/v1/oms/setup/addresses/get_async_status/` 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/setup/addresses/get_async_status/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())

```

**Response 200 OK**

Possible values of result are:

* READY
* WORKING
* FINISHED
* FAILED
* ABORTED

| Parameter | Data Type | Description            |
| --------- | --------- | ---------------------- |
| reuslt    | string    | The status of the task |

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

```json
{
  "result": "Ready"
}
```

### `GET` Is Required

This endpoint indicates whether the "execute" endpoint should be called or not. It returns "true" if there are any countries, cities, townships, or districts in Omnitron that are not present in OMS.

**Path:** `/api/v1/oms/setup/addresses/is_required/`

**Request Body**

The following query parameters can be used to execute the setup.

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

**Example Request**

To execute this setup step, a `POST` request should be sent to the `/api/v1/oms/setup/addresses/is_required/` 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/setup/addresses/is_required/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.status_code)

```

**Response 200 OK**

Possible values of result are true and false.

| Parameter | Data Type | Description                           |
| --------- | --------- | ------------------------------------- |
| result    | string    | Whether the task should be run or not |

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

```json
{
  "result": "true"
}
```


---

# 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/address-setup-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.
