diff --git a/doc/API/API-Docs.md b/doc/API/API-Docs.md
index ddd786d54..2c3c62847 100644
--- a/doc/API/API-Docs.md
+++ b/doc/API/API-Docs.md
@@ -17,6 +17,7 @@
- [`get_graph_by_port_hostname`](#api-route-9)
- [`list_devices`](#api-route-10)
- [`add_device`](#api-route-11)
+ - [`list_oxidized`](#api-route-21)
- [`routing`](#api-routing)
- [`list_bgp`](#api-route-1)
- [`switching`](#api-switching)
@@ -395,6 +396,36 @@ Output:
}
```
+### Function: `list_oxidized` [`top`](#top)
+
+List devices for use with Oxidized.
+
+Route: /api/v0/oxidized
+
+Input (JSON):
+
+ -
+
+Examples:
+```curl
+curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/oxidized
+```
+
+Output:
+
+```text
+[
+ {
+ "hostname": "localhost",
+ "os": "linux"
+ },
+ {
+ "hostname": "otherserver",
+ "os": "linux"
+ }
+]
+```
+
## `Routing` [`top`](#top)
### Function: `list_bgp` [`top`](#top)
diff --git a/html/api_v0.php b/html/api_v0.php
index d049cb350..81b81f11a 100644
--- a/html/api_v0.php
+++ b/html/api_v0.php
@@ -29,6 +29,7 @@ $app->setName('api');
$app->group('/api', function() use ($app) {
$app->group('/v0', function() use ($app) {
$app->get('/bgp', 'authToken', 'list_bgp')->name('list_bgp');//api/v0/bgp
+ $app->get('/oxidized', 'authToken', 'list_oxidized')->name('list_oxidized');
$app->group('/devices', function() use ($app) {
$app->delete('/:hostname', 'authToken', 'del_device')->name('del_device');//api/v0/devices/$hostname
$app->get('/:hostname', 'authToken', 'get_device')->name('get_device');//api/v0/devices/$hostname
diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php
index 019b073c2..d4dce5e87 100644
--- a/html/includes/api_functions.inc.php
+++ b/html/includes/api_functions.inc.php
@@ -699,3 +699,17 @@ function get_inventory() {
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}
+
+function list_oxidized() {
+ // return details of a single device
+ $app = \Slim\Slim::getInstance();
+ $app->response->headers->set('Content-Type', 'application/json');
+
+ $devices = array();
+ foreach (dbFetchRows("SELECT hostname,os FROM `devices` WHERE `status`='1'") as $device) {
+ $devices[] = $device;
+ }
+ $app->response->headers->set('Content-Type', 'application/json');
+ echo _json_encode($devices);
+
+}