# Devices

## Devices - AddIgnoredIPs

Adds devices to the ignored IP list.

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/ignoredips
```

### Parameter

| Field | Label in UI |   Type | Description                                                                                                                                               |
| ----- | ----------: | -----: | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ip    |           - | String | IP address that should be ignored from the list of DetectBlockedIps. Execute Devices - ListBlockedIps API to obtain blocked IP addresses. Mandatory Field |

### Request Example

```json
{
    "data": {
        "ip": "192.168.1.2"
    }
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - Attach

Attaches devices on behalf of the collector LogPoint from the main LogPoint in a Distributed LogPoint setup.

{% hint style="danger" %}
DEPRECATED — Will be removed in future version. Use the distributed\_collector parameter of the [Devices - Create](#devices-create) or [Devices - Edit API](#devices-edit) to attach Distributed collectors.
{% endhint %}

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}/attach
```

### Parameter

| Field                  |           Label in UI |   Type | Description                                                                                                |
| ---------------------- | --------------------: | -----: | ---------------------------------------------------------------------------------------------------------- |
| distributed\_collector | Distributed Collector | String | Existing Distributed collector id. Obtain the value using DistributedCollector - List API. Mandatory Field |
| id                     |                     - | String | Existing Device id. Obtain the value using Devices - List API. Mandatory Field                             |

### Request Example

```json
{
    "data": {
        "distributed_collector": "574fda0bd8aaa4073b9473d8"
    }
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - Create

Creates a new device in a Fabric-enabled LogPoint.

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices
```

### Parameter

| Field                  |            Label in UI |      Type | Description                                                                                                                                 |
| ---------------------- | ---------------------: | --------: | ------------------------------------------------------------------------------------------------------------------------------------------- |
| availability           |           Availability |    String | A string value which could be Minimal, Minor, Major, Critical that defines the availability of the device. Mandatory Field                  |
| confidentiality        |        Confidentiality |    String | A string value which could be Minimal, Minor, Major, Critical that defines the confidentiality of the device. Mandatory Field               |
| devicegroup            |          Device Groups | \[String] | List of ID of the existing Device Group where you want to create the device. Use DeviceGroup - List API to obtain the value. Optional Field |
| distributed\_collector | Distributed Collectors | \[String] | List of ID of Distributed Collectors. Use DistributedCollectors - List API to obtain the value. Optional Field                              |
| integrity              |              Integrity |    String | A string value which could be Minimal, Minor, Major, Critical that defines the integrity of the device. Mandatory Field                     |
| ip                     |     Device address(es) | \[String] | Can have valid IP address(es), CIDR address(es), hostname(s) or combination of these as values. Mandatory Field                             |
| logpolicy              |  Log Collection Policy | \[String] | List of ID of Log Collection Policies. Use LogCollectionPolicies - List API to obtain the value. Optional Field                             |
| name                   |                   Name |    String | Device name. Mandatory Field                                                                                                                |
| timezone               |              Time Zone |    String | Optional string value that specifies the timezone by logpoint. Obtain available timezones using Timezone - List API. Optional Field         |

### Request Example

```json
{
    "data": {
        "availability": "Minimal",
        "confidentiality": "Minimal",
        "devicegroup": [
            "574fb123d8aaa4625bfe2d23"
        ],
        "distributed_collector": [
            "5db02cbcd8aaa42fddb6f72f"
        ],
        "integrity": "Minimal",
        "ip": [
            "192.168.1.2",
            "google.com"
        ],
        "logpolicy": [
            "5d88c559d8aaa42d8c4bfc41"
        ],
        "name": "device1",
        "timezone": "Asia/Kathmandu"
    }
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

***

## Devices - Detach

Detaches devices on behalf of the collector LogPoint from the main LogPoint in the Distributed LogPoint setup.

{% hint style="danger" %}
DEPRECATED — Will be removed in future version. Use the distributed\_collector parameter of the [Devices - Edit API](#devices-edit) to detach Distributed collectors.
{% endhint %}

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}/detach
```

### Parameter

| Field                  |           Label in UI |   Type | Description                                                                                                |
| ---------------------- | --------------------: | -----: | ---------------------------------------------------------------------------------------------------------- |
| distributed\_collector | Distributed Collector | String | Existing Distributed collector id. Obtain the value using DistributedCollector - List API. Mandatory Field |
| id                     |                     - | String | Existing Device id. Obtain the value using Devices - List API. Mandatory Field                             |

### Request Example

```json
{
    "data": {
        "distributed_collector": "574fda0bd8aaa4073b9473d8"
    }
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - Edit

Edits the device settings with given ID.

**PUT**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}
```

### Parameter

| Field                  |            Label in UI |      Type | Description                                                                                                                         |
| ---------------------- | ---------------------: | --------: | ----------------------------------------------------------------------------------------------------------------------------------- |
| availability           |           Availability |    String | A string value which could be Minimal, Minor, Major, Critical that defines the availability of the device. Mandatory Field          |
| confidentiality        |        Confidentiality |    String | A string value which could be Minimal, Minor, Major, Critical that defines the confidentiality of the device. Mandatory Field       |
| devicegroup            |          Device Groups | \[String] | List of ID of the existing Device Group. Use DeviceGroup - List API to obtain the value. Optional Field                             |
| distributed\_collector | Distributed Collectors | \[String] | List of ID of Distributed Collectors. Use DistributedCollectors - List API to obtain the value. Optional Field                      |
| id                     |                      - |    String | Existing Device id. Obtain the value using Devices - List API. Mandatory Field                                                      |
| integrity              |              Integrity |    String | A string value which could be Minimal, Minor, Major, Critical that defines the integrity of the device. Mandatory Field             |
| ip                     |     Device address(es) | \[String] | Can have valid IP address(es), CIDR address(es), hostname(s) or combination of these as values. Mandatory Field                     |
| logpolicy              |  Log Collection Policy | \[String] | List of ID of Log Collection Policies. Use LogCollectionPolicies - List API to obtain the value. Optional Field                     |
| name                   |                   Name |    String | Device name. Mandatory Field                                                                                                        |
| timezone               |              Time Zone |    String | Optional string value that specifies the timezone by logpoint. Obtain available timezones using Timezone - List API. Optional Field |

### Request Example

```json
{
    "data": {
        "availability": "Minimal",
        "confidentiality": "Minimal",
        "devicegroup": [
            "574fb123d8aaa4625bfe2d23"
        ],
        "distributed_collector": [
            "5db02cbcd8aaa42fddb6f72f"
        ],
        "integrity": "Minimal",
        "ip": [
            "192.168.1.2",
            "google.com"
        ],
        "logpolicy": [
            "5d88c559d8aaa42d8c4bfc41"
        ],
        "name": "device1",
        "timezone": "Asia/Kathmandu"
    }
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - Get

Fetches the device with given ID.

**GET**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}
```

### Parameter

| Field | Label in UI |   Type | Description                                       |
| ----- | ----------: | -----: | ------------------------------------------------- |
| id    |           - | String | ID of the existing device that you want to fetch. |

### Success Response

```json
{
    "active": true,
    "col_apps": [],
    "device_groups": [
        "62e8a1f2785762f6c5f2d372"
    ],
    "distributed_collector": [],
    "has_hostname": true,
    "id": "63da2ac979385684d98f4263",
    "ip": [
        "192.168.2.10",
        "google.com"
    ],
    "log_policies": [],
    "name": "device1",
    "risk_values": {
        "availability": "Minimal",
        "confidentiality": "Minimal",
        "integrity": "Minimal"
    },
    "tid": "",
    "timezone": "Asia/Kathmandu",
    "type": null
}
```

## Devices - GetPlugins

Fetches plugins with given Device ID.

**GET**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}/plugins
```

### Parameter

| Field | Label in UI |   Type | Description                                               |
| ----- | ----------: | -----: | --------------------------------------------------------- |
| id    |           - | String | ID of the existing device whose plugin you want to fetch. |

### Success Response

```json
[
    {
        "CSRFToken": "cknHNJFOKZGrCfm",
        "LOGGEDINUSER": "admin",
        "app": "SnareCollector",
        "charset": "utf_8",
        "hasLCP": "0",
        "ips": "181.170.0.101",
        "normalizer": "None",
        "parser": "LineParser",
        "repo": "default",
        "requestType": "formsubmit",
        "sid": "snare|device-NewDevice_101"
    },
    {
        "CSRFToken": "cknHNJFOKZGrCfm",
        "LOGGEDINUSER": "admin",
        "app": "SyslogCollector",
        "charset": "utf_8",
        "hasLCP": "0",
        "ips": "181.170.0.101",
        "normalizer": "None",
        "parser": "SyslogParser",
        "proxy_condition": "None",
        "repo": "default",
        "requestType": "formsubmit",
        "sid": "syslog|device-NewDevice_101"
    }
]
```

## Devices - Install

Install a given CSV file containing devices.

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/install
```

### Parameter

| Field          | Label in UI |   Type | Description                                                                                    |
| -------------- | ----------: | -----: | ---------------------------------------------------------------------------------------------- |
| file\_location |           - | String | Location of the file uploaded to install. Can be either 'private' or 'public'. Mandatory Field |
| file\_name     |           - | String | Name of the CSV file containing Devices. Mandatory Field                                       |

### Request Example

```json
{
    "data": {
        "file_location": "private",
        "file_name": "devices.csv"
    }
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - List

Lists all devices in the Fabric-enabled LogPoint.

**GET**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices
```

### Success Response

```json
[
    {
        "active": true,
        "col_apps": [
            {
                "app": "SCPFetcher",
                "auth_password": "CvG244MgnWCj2qcacCeBnO1JUfXCICFvU3gs7eXXfzw=",
                "auth_type": "password",
                "charset": "ascii",
                "interval": "9",
                "namepattern": "*.pyc",
                "parser": "SyslogParser",
                "port": "22",
                "processpolicy": "62e8a1f2785762f6c5f2d36c",
                "remotepath": "C:\\\\test\\\\folder",
                "sid": "scp|device-device4:SCPTest:22:C:\\\\test\\\\folder:*.pyc",
                "username": "SCPTest",
                "uuid": "25efde05c2174722a1f6dc7642b4f4b2"
            },
            {
                "app": "FTPFetcher",
                "charset": "ascii",
                "interval": "34",
                "namepattern": "*.pyc",
                "oldlogs": "off",
                "parser": "SyslogParser",
                "password": "YaNEZM5wl6ffOp73bEc/wrPQxv94QsvWP8lncT3C+is=",
                "port": "33",
                "processpolicy": "62e8a1f2785762f6c5f2d36c",
                "remotepath": "/base/collection/",
                "sid": "ftpf|device-device4:ftptest:33:/base/collection/:*.pyc",
                "username": "FTPtest",
                "uuid": "39154458f8494d0dbd70f5df40d9215d"
            }
        ],
        "device_groups": [
            "62e8a1f2785762f6c5f2d372"
        ],
        "distributed_collector": [],
        "has_hostname": true,
        "id": "63da2ae41547b9cbd69b3f7f",
        "ip": [
            "192.168.2.11",
            "google.com"
        ],
        "log_policies": [],
        "name": "device4",
        "risk_values": {
            "availability": "Minimal",
            "confidentiality": "Minimal",
            "integrity": "Minimal"
        },
        "tid": "",
        "timezone": "Asia/Kathmandu",
        "type": null
    }
]
```

## Devices - ListBlockedIps

Lists the IPs of all the devices in the blocked IP list.

**GET**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/blockedips
```

### Success Response

```json
[
    {
        "collected_at": "LogPoint204",
        "ip": "10.45.3.218",
        "name": "10_45_3_218"
    }
]
```

## Devices - ListIgnoredIps

Lists the IPs of all the devices in the ignored IP list.

**GET**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/ignoredips
```

### Success Response

```json
[
    {
        "id": "5a1fd832d8aaa41eeee5e5cf",
        "ips": [
            "10.94.0.142"
        ]
    },
    {
        "id": "5a2521fdd8aaa41eeee5e5d2",
        "ips": [
            "10.94.1.22"
        ]
    },
    {
        "id": "5a2521ffd8aaa41eeee5e5d3",
        "ips": [
            "10.94.0.82"
        ]
    }
]
```

## Devices - ListPrivateUploads

List all the csv files that contains device configurations in private storage.

**GET**

```
https://api-server-host-name/configapi/{pool_UUID}/Devices/list
```

### Success Response

```json
[
    "devices.csv"
]
```

***

## Devices - ListPublicUploads

List all the csv files that contains device configurations in public storage.

**GET**

```
https://api-server-host-name/configapi/Devices/list
```

### Success Response

```json
[
    "devices.csv"
]
```

## Devices - RefreshBlockedIpsList

Updates the blocked IP list.

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/detectblockedips/refreshlist
```

### Request Example

```json
{
    "data": {}
}
```

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - Trash

Removes the device with given ID.

**DELETE**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}
```

### Parameter

| Field | Label in UI |   Type | Description                                                        |
| ----- | ----------: | -----: | ------------------------------------------------------------------ |
| id    |           - | String | ID of the existing device that you want to delete. Mandatory Field |

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - TrashIgnoredIps

Removes any device IP with given ID from the ignored IP list.

**DELETE**

```
https://api-server-host-name/configapi/{pool_UUID}/{logpoint_identifier}/Devices/{id}/ignoredips
```

### Parameter

| Field | Label in UI |   Type | Description                                                                                    |
| ----- | ----------: | -----: | ---------------------------------------------------------------------------------------------- |
| id    |           - | String | ID of the ignored IP address that you want to remove from the Ignored IP List. Mandatory Field |

### Success Response

```json
{
    "status": "Success",
    "message": "/monitorapi/{pool_UUID}/{logpoint_identifier}/orders/{request_id}"
}
```

## Devices - TrashPrivateUploads

Delete the file with given name from private storage.

**DELETE**

```
https://api-server-host-name/configapi/{pool_UUID}/Devices/{file_name}
```

### Parameter

| Field      | Label in UI |   Type | Description                                     |
| ---------- | ----------: | -----: | ----------------------------------------------- |
| file\_name |             | String | Name of the file to be deleted. Mandatory Field |

### Success Response

```json
{
    "status": "Success",
    "message": "devices.csv successfully deleted"
}
```

## Devices - TrashPublicUploads

Delete the file with given name from public storage.

**DELETE**

```
https://api-server-host-name/configapi/Devices/{file_name}
```

### Parameter

| Field      | Label in UI |   Type | Description                                     |
| ---------- | ----------: | -----: | ----------------------------------------------- |
| file\_name |             | String | Name of the file to be deleted. Mandatory Field |

### Success Response

```json
{
    "status": "Success",
    "message": "devices.csv successfully deleted"
}
```

## Devices - Upload

Upload csv file containing device configurations to private storage.

**POST**

```
https://api-server-host-name/configapi/{pool_UUID}/Devices/upload
```

### Header

| Field             | Label in UI | Description                                                                                                                   |
| ----------------- | ----------: | ----------------------------------------------------------------------------------------------------------------------------- |
| file\_name        |             | Name of the file to be uploaded.                                                                                              |
| Content-Type      |             | application/octet-stream                                                                                                      |
| replace\_existing |             | Set to 'true' to replace an existing file with the same name. Default 'false'. Value can be 'true' or 'false'. Optional field |

### Parameter

| Field | Label in UI |      Type | Description                           |
| ----- | ----------: | --------: | ------------------------------------- |
| file  |             | \[Object] | (csv) to be uploaded. Mandatory Field |

### Success Response

```json
{
    "status": "Success",
    "message": "devices.csv successfully uploaded in private storage. "
}
```

## Devices - UploadPublic

Upload csv file containing device configurations to public storage.

**POST**

```
https://api-server-host-name/configapi/Devices/publicupload
```

### Header

| Field             | Label in UI | Description                                                                                                                   |
| ----------------- | ----------: | ----------------------------------------------------------------------------------------------------------------------------- |
| file\_name        |             | Name of the file to be uploaded.                                                                                              |
| Content-Type      |             | application/octet-stream                                                                                                      |
| replace\_existing |             | Set to 'true' to replace an existing file with the same name. Default 'false'. Value can be 'true' or 'false'. Optional field |

### Parameter

| Field | Label in UI |      Type | Description                           |
| ----- | ----------: | --------: | ------------------------------------- |
| file  |             | \[Object] | (csv) to be uploaded. Mandatory Field |

### Success Response

```json
{
    "status": "Success",
    "message": "devices.csv successfully uploaded in public storage."
}
```
