# **Application Logs**

Efficiently manage and retrieve application logs with the "Application Logs" section.

## **Create Application Log**

To create an application log, utilize the following endpoint: `POST /api/AppLog`

### **Input**


```json
//POST /api/AppLog
{
  "applicationGuid": "dd1d816d-2e80-478c-93fa-6cf29b168de1",
  "owner": "My owner",
  "scope": "My scope",
  "source": "My source",
  "target": "My target",
  "payload": "My payload"
}
```

| Field | Description |
|  --- | --- |
| ApplicationGuid | The application guid associated with the log |
| Owner | Who sent the event |
| Scope | The reason of the event |
| Target | Where the event is received |
| Payload | The content of the event |


### **Output**


```json
{
  "guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "applicationGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "owner": "string",
  "timeStamp": "2023-05-03T12:59:37.110Z",
  "scope": "string",
  "source": "string",
  "ip": "string",
  "target": "string",
  "hash": "string",
  "payload": "string"
}
```

| Field | Description |
|  --- | --- |
| Guid | The auto generated guid |
| Application Guid | Same as input |
| Owner | Same as input |
| TimeStamp | When the application log is created |
| Scope | Same as input |
| Source | Same as input |
| Ip | The IPv4 or IPv6 from where the application log is created |
| Target | Same as input |
| Hash | The hash of the application log that will be sent on the blockchain |
| Payload | Same as input |


## **Get application logs**

To retrieve application logs, use the following endpoint: `POST /api/AppLog/List`

### **Input**


```json
//POST /api/AppLog/List
{
  "applicationGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "dateFrom": "2020-04-01T00:00:00.0000000",
  "dateTo": "2030-04-01T00:00:00.0000000",
  "page": 1,
  "itemsPerPage": 20
}
```

| Field | Description |
|  --- | --- |
| ApplicationGuid | Filters the application logs by the application guid |
| DateFrom | If set, retrieves the logs created starting from this date |
| DateTo | If set, retrieves the logs created up to this date |
| Page | Page number |
| ItemsPerPage | Items per page |


The only input required parameters are `page` and `itemsPerPage`

### **Output**


```json
[
  {
    "guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "applicationGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "owner": "string",
    "timeStamp": "2023-05-03T14:08:33.901Z",
    "scope": "string",
    "source": "string",
    "ip": "string",
    "target": "string",
    "payload": "string",
    "blockchainStatus": 0,
    "blockchainStatusDate": "2023-05-03T14:08:33.901Z",
    "blockchainProcessId": "string",
    "blockchainUuid": "string",
    "hash": "string",
    "blockchainTxHashUrl": "string"
  }
]
```

| Field | Description |
|  --- | --- |
| Guid | The application log guid |
| ApplicationGuid | The application guid related to the log |
| Owner | The owner of the application log |
| TimeStamp | When the application log is created |
| Scope | The scope of the application log |
| Source | The source of the application log |
| Ip | The IPv4 or IPv6 from where the application log is created |
| Target | The target of the application log |
| Payload | The payload of the application log |
| BlockchainStatus | Save status on the blockchain (Registered = 0, Queued = 1, ProcessCreated = 2, Notarized = 3, Error = 4) |
| BlockchainStatusDate | When the status of the save on the blockchain changes |
| BlockchainProcessId | The id of the process on the blockchain |
| BlockchainUuid | UUID generated by the blockchain |
| Hash | The hash of the application log that is sent to the blockchain |
| BlockchainTxHashUrl | The hash produced by the blockchain on success (the blockchain may take a bit of time and it may not be valorized immediately after the creation of a consent) |


The result collection doesn't include application logs related to deleted applications

## **Get audit trail PDF**

To get the audit trail PDF document use the following endpoint:

`GET /api/AppLog/GetAuditTrail/{applicationLogGuid}`

### **Output**

The Audit Trail PDF file