# API: Log Http

---

- [Introdução](#intro)
- [Index](#index)
- [List Configs](#list_configs)
- [Set Configs](#set_configs)

<a name="intro"></a>
## Introdução

Esses endpoints são responsáveis por configurar e gerenciar os endpoints que receberão log no sistema via middleware App\Http\Middleware\HttpRequestLogMiddleware.

<a nam="index"></a>
## Index

Este endpoint retorna os logs registrados.

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|POST|`/http-logs`|Default|

### Body
```json
Empty
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
[
    {
        "id": <id>,
        "http_method": <http_method>,
        "path": <path>,
        "payload": [<payload>],
        "response_body": {<response_body>},
        "created_at": <created_at>,
        "user_id": <user_id>
    },
    //...
]
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>403 - Forbidden</larecipe-badge>
```json
{
    "message": "User does not have the right roles.",
}
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```

<a nam="list_configs"></a>
## List Configs

Retorna uma lista de configurações de log, ou seja, uma lista dos endpoints do sistema, com um indicador booleano que especifica se o log está sendo registrado ou não. As configurações são armazenadas em um arquivo JSON físico localizado no diretório `storage/app/private/routes` no servidor.

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|GET|`/http-logs/configs`|Default|

### Body
```json
Empty
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
[
    {
        "path": <path>,
        "isAuditing": <isAuditing>,
        "description": <description>,
        "http_method": <http_method>
    },
    //...
]
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>403 - Forbidden</larecipe-badge>
```json
{
    "message": "User does not have the right roles.",
}
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```

<a nam="set_configs"></a>
## Set Configs

Endpoint usado para configurar os endpoints que receberão ou não logs.

### Endpoint
|Método|URI|Headers|
|:|:-|:|
|GET|`/http-logs/configs`|Default|

### Body
```json
Empty
```

### Responses
<larecipe-badge type="success" rounded><i class="fa fa-check" style="margin-right:9px"></i>200 - OK</larecipe-badge>
```json
[
    {
        "path": <path>,
        "isAuditing": <isAuditing>,
        "description": <description>,
        "http_method": <http_method>
    },
    //...
]
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>403 - Forbidden</larecipe-badge>
```json
{
    "message": "User does not have the right roles.",
}
```

<larecipe-badge type="danger" rounded><i class="fa fa-lock" style="margin-right:9px"></i>401 - Unauthorized</larecipe-badge>
```json
{
    "message": "Unauthenticated."
}
```