# Action Log Services

All services related to action logs are listed in this page.

### `GET` Action Log List

Returns all action logs with detailed information.

**Path:** `/api/v1/oms/logs/action_log/`

**Query Parameters**

The following query parameters can be used to get the details of action logs.

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

**Example Request**

To get a detailed list of all action logs, a `GET` request should be sent to\
the `/api/v1/oms/logs/action_log/` 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/logs/action_log/"
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 the\
details of all action logs. The response body contains a `JSON` object with\
the action logs and their attributes such as ID, level, logger name, message\
etc.

These parameters are described in the following table.

| Parameter    | Data Type | Description                                                      |
| ------------ | --------- | ---------------------------------------------------------------- |
| id           | integer   | The primary key of the action log                                |
| level        | integer   | The level type of the action log                                 |
| logger\_name | string    | The logger name of the action log                                |
| message      | string    | The detail of the action log                                     |
| app\_name    | string    | The app name of the action log (which app belongs to this error) |
| trace        | string    | The traceback detail of the action log                           |
| created\_at  | date      | The creation date of the action log                              |

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

```json
{
  "count": 15,
  "next": "https://{domain_url}/api/v1/oms/logs/action_log/?page=2",
  "previous": null,
  "results": [
    {
      "id": 105,
      "level": 40,
      "logger_name": "logger_name_14",
      "message": "Test Log Message 14",
      "app_name": "oms",
      "trace": "Test Log Trace 14",
      "created_at": "2023-12-01T08:25:56.088353Z"
    },
    {
      "id": 104,
      "level": 0,
      "logger_name": "logger_name_13",
      "message": "Test Log Message 13",
      "app_name": "oms",
      "trace": "Test Log Trace 13",
      "created_at": "2023-12-01T08:25:56.087033Z"
    },
    {
      "id": 103,
      "level": 30,
      "logger_name": "logger_name_12",
      "message": "Test Log Message 12",
      "app_name": "oms",
      "trace": "Test Log Trace 12",
      "created_at": "2023-12-01T08:25:56.085617Z"
    },
    {
      "id": 102,
      "level": 0,
      "logger_name": "logger_name_11",
      "message": "Test Log Message 11",
      "app_name": "oms",
      "trace": "Test Log Trace 11",
      "created_at": "2023-12-01T08:25:56.084256Z"
    },
    {
      "id": 101,
      "level": 20,
      "logger_name": "logger_name_10",
      "message": "Test Log Message 10",
      "app_name": "oms",
      "trace": "Test Log Trace 10",
      "created_at": "2023-12-01T08:25:56.083049Z"
    },
    {
      "id": 100,
      "level": 30,
      "logger_name": "logger_name_9",
      "message": "Test Log Message 9",
      "app_name": "oms",
      "trace": "Test Log Trace 9",
      "created_at": "2023-12-01T08:25:56.081900Z"
    },
    {
      "id": 99,
      "level": 40,
      "logger_name": "logger_name_8",
      "message": "Test Log Message 8",
      "app_name": "oms",
      "trace": "Test Log Trace 8",
      "created_at": "2023-12-01T08:25:56.080747Z"
    },
    {
      "id": 98,
      "level": 0,
      "logger_name": "logger_name_7",
      "message": "Test Log Message 7",
      "app_name": "oms",
      "trace": "Test Log Trace 7",
      "created_at": "2023-12-01T08:25:56.079269Z"
    },
    {
      "id": 97,
      "level": 30,
      "logger_name": "logger_name_6",
      "message": "Test Log Message 6",
      "app_name": "oms",
      "trace": "Test Log Trace 6",
      "created_at": "2023-12-01T08:25:56.077952Z"
    },
    {
      "id": 96,
      "level": 20,
      "logger_name": "logger_name_5",
      "message": "Test Log Message 5",
      "app_name": "oms",
      "trace": "Test Log Trace 5",
      "created_at": "2023-12-01T08:25:56.076723Z"
    }
  ]
}
```

### `GET` Single Action Log

Returns detailed information of a single action log with given ID.

**Path:** `/api/v1/oms/logs/action_log/{id}/`

**Query Parameters**

The following query parameters can be used to get the details of action log.

| Parameter | Data Type | In     | Description                         |
| --------- | --------- | ------ | ----------------------------------- |
| token     | string    | header | The API key of the customer account |
| {id}      | integer   | url    | The ID of the action log            |

**Example Request**

To retrieve detailed information of given action log, a `GET` request should\
be sent to the `/api/v1/oms/logs/action_log/{id}/` 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/logs/action_log/{id}/"
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 the\
detailed information of given action log. The response body contains\
a `JSON` object with the given action logs' attributes such as ID, level, logger\
name, message etc.

These parameters are described in the following table.

| Parameter    | Data Type | Description                                                      |
| ------------ | --------- | ---------------------------------------------------------------- |
| id           | integer   | The primary key of the action log                                |
| level        | integer   | The level type of the action log                                 |
| logger\_name | string    | The logger name of the action log                                |
| message      | string    | The detail of the action log                                     |
| app\_name    | string    | The app name of the action log (which app belongs to this error) |
| trace        | string    | The trace back detail of the action log                          |
| created\_at  | date      | The creation date of the action log                              |

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

```json
{
  "id": 100,
  "level": 30,
  "logger_name": "logger_name_9",
  "message": "Test Log Message 9",
  "app_name": "oms",
  "trace": "Test Log Trace 9",
  "created_at": "2023-12-01T08:25:56.081900Z"
}
```
