# Channel Services

All services related to channel are listed in this page.

### `GET` Channel List

This method used to get list of channels.

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

**Example Request**

To get list of channels, a `GET` request should be sent to `/api/v1/oms/channels/` endpoint.

This request does not require any query parameters or a request body.

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/channels/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

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

print(response.json())
```

**Example Response (200)**

In a successful response with a status code of `200 OK`, the API will provide a list of channel information.

| Parameter      | Data Type | Description                          |
| -------------- | --------- | ------------------------------------ |
| id             | integer   | The primary key of the channel       |
| name           | string    | The name of the channel              |
| omnitron\_id   | integer   | The Omnitron ID of the channel       |
| created\_date  | date      | The creation date                    |
| modified\_date | date      | The last modified date               |
| type           | boolean   | The type of the channel              |
| configuration  | object    | The configuration of the channel     |
| is\_active     | boolean   | The activation status of the channel |

This example response serves as a reference to understand the structure and data format of channels list.

```json
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 2,
      "channel_type": "n11",
      "created_date": "2023-08-03T10:35:21.199394Z",
      "modified_date": "2023-08-03T10:35:21.199400Z",
      "omnitron_id": 345,
      "name": "Buzz",
      "configuration": {},
      "is_active": true
    },
    {
      "id": 1,
      "channel_type": "web",
      "created_date": "2023-08-06T10:35:21.194696Z",
      "modified_date": "2023-08-03T10:35:21.197714Z",
      "omnitron_id": 123,
      "name": "Fizz",
      "configuration": {},
      "is_active": true
    }
  ]
}

```

### `GET` Channel Detail

This method used to get details of the channel for given ID parameter.

**Path:** `/api/v1/oms/channels/{id}/`

**Example Request**

To get channel detail, a `GET` request should be sent to `/api/v1/oms/channels/{id}/` endpoint.

This request does not require any query parameters or a request body.

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/channels/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

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

print(response.json())
```

**Example Response (200)**

In a successful response with a status code of `200 OK`, the API will provide channel detail information.

| Parameter      | Data Type | Description                          |
| -------------- | --------- | ------------------------------------ |
| id             | integer   | The primary key of the channel       |
| name           | string    | The name of the channel              |
| omnitron\_id   | integer   | The Omnitron ID of the channel       |
| created\_date  | date      | The creation date                    |
| modified\_date | date      | The last modified date               |
| type           | boolean   | The type of the channel              |
| configuration  | object    | The configuration of the channel     |
| is\_active     | boolean   | The activation status of the channel |

This example response serves as a reference to understand the structure and data format of channels detail.

```json
 {
      "id": 2,
      "channel_type": "n11",
      "created_date": "2023-08-03T10:35:21.199394Z",
      "modified_date": "2023-08-03T10:35:21.199400Z",
      "omnitron_id": 345,
      "name": "Buzz",
      "configuration": {},
      "is_active": true
}
```

### `DELETE` Channel Deactivate

This method is used to deactivate a channel. After a channel is created, it cannot be deleted due to potential sync issues; hence, the only option available is to deactivate it.

**Path:** `/api/v1/oms/channels/{id}/`

**Example Request**

To deactivate channel, a `DELETE` request should be sent to `/api/v1/oms/channels/{id}/` endpoint.

This request does not require any query parameters or a request body.

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/channels/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("DELETE", url, headers=headers)

print(response.json())
```

**Example Response (204)**

In a successful response with a status code of `204 No Content`, the API does not include any response data in the body.

### `GET` Channel List - Short

This method is used to get a short list of channels with limited information, specifically containing only the `id` and `name` parameters for each channel.

**Path:** `/api/v1/oms/channels/short/`

**Example Request**

To get channel short list, a `GET` request should be sent to `/api/v1/oms/channels/short/` endpoint.

This request does not require any query parameters or a request body.

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/channels/short/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

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

print(response.json())
```

**Example Response (200)**

In a successful response with a status code of `200 OK`, the API will provide a short list of channel information.

| Parameter | Data Type | Description                    |
| --------- | --------- | ------------------------------ |
| id        | integer   | The primary key of the channel |
| name      | string    | The name of the channel        |

This example response serves as a reference to understand the structure and data format of channels short list.

```json
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
      {
        "id": 2,
        "name": "Buzz"
      },
      {
        "id": 1,
        "name": "Fizz"
      }
    ]
}
```
