
= Device Config REST API

Use the Device Config REST API to fetch existing configurations and trigger retrieval of the device configs.

NOTE: If not otherwise specified, the `Content-Type` of the request and response is `application/json`.

[caption=]
.Device Config API functions
[cols="1,1,3"]
|===
| Resource  | Method    | Description

| /device-config
| GET
| Retrieves all the configurations, sorted by `lastUpdated`.
This API also supports the following query paramaters: `limit`, `offset`, `orderBy`, `order`, `deviceName`, `ipAddress`, `configType`, `createdAfter`, and `createdBefore`.

| /device-config/\{id}
| GET
| Retrieves the configuration for the specific ID (database ID).

| /device-config/interface/\{id}
| GET
| Retrieves all the configurations for the specific interface.

| /device-config/latest
| GET
| Retrieves the latest configuration for all devices.
This API supports the following query parameters: `limit`, `offset`, `orderBy`, `order`, `search`, and `status`.

| /device-config/download?id=\{id1, id2}
| GET
| Download the configurations with the given ID or IDs.

| /device-config/backup
| POST
| Trigger backup for a given interface and location.
|===

== Examples:

.Trigger device configuration backup
[source,bash]
----
curl -u admin:admin -d '[{"ipAddress":"192.168.1.123","location":"Default","serviceName":"DeviceConfig-default", "blocking": false}]' -H "Content-Type: application/json" -X POST http://localhost:8980/opennms/rest/device-config/backup -v
----
