mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Update api route to portgroups
This commit is contained in:
+2
-2
@@ -36,8 +36,8 @@ $app->group('/api', function() use ($app) {
|
||||
$app->get('/:hostname/ports/:ifname', 'authToken', 'get_port_stats_by_port_hostname')->name('get_port_stats_by_port_hostname');//api/v0/devices/$hostname/ports/$ifName
|
||||
$app->get('/:hostname/ports/:ifname/:type', 'authToken', 'get_graph_by_port_hostname')->name('get_graph_by_port_hostname');//api/v0/devices/$hostname/ports/$ifName/$type
|
||||
});
|
||||
$app->group('/graphs', function() use ($app) {
|
||||
$app->get('/ports/:group', 'authToken', 'get_graph_by_group')->name('get_graph_by_group');//api/v0/graphs/ports/$group
|
||||
$app->group('/portgroups', function() use ($app) {
|
||||
$app->get('/:group', 'authToken', 'get_graph_by_group')->name('get_graph_by_portgroup');//api/v0/portgroups/$group
|
||||
});
|
||||
$app->get('/devices', 'authToken', 'list_devices')->name('list_devices');//api/v0/devices
|
||||
$app->post('/devices', 'authToken', 'add_device')->name('add_device');//api/v0/devices (json data needs to be passed)
|
||||
|
||||
@@ -377,7 +377,7 @@ function list_bgp() {
|
||||
echo _json_encode($output);
|
||||
}
|
||||
|
||||
function get_graph_by_group() {
|
||||
function get_graph_by_portgroup() {
|
||||
global $config;
|
||||
$app = \Slim\Slim::getInstance();
|
||||
$router = $app->router()->getCurrentRoute()->getParams();
|
||||
|
||||
@@ -164,7 +164,7 @@ if ($_SESSION['userlevel'] == '10')
|
||||
<tr>
|
||||
<td>/api</td>
|
||||
<td>/v0</td>
|
||||
<td>/graphs/ports/$group</td>
|
||||
<td>/portgroups/$group</td>
|
||||
<td>
|
||||
<ul class="list-unstyled">
|
||||
<li>$group = transit,peering,core (or multiple separated by comma)</li>
|
||||
@@ -180,10 +180,10 @@ if ($_SESSION['userlevel'] == '10')
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"><code>curl -H "Content-Type: application/json" -H "X-Auth-Token: 91c60e737e342c205be5bba8e2954d27" \<br/> "https://librenms.example.com/api/v0/graphs/ports/peering"</code></td>
|
||||
<td colspan="5"><code>curl -H "Content-Type: application/json" -H "X-Auth-Token: 91c60e737e342c205be5bba8e2954d27" \<br/> "https://librenms.example.com/api/v0/portgroups/peering"</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"><code>curl -H "Content-Type: application/json" -H "X-Auth-Token: 91c60e737e342c205be5bba8e2954d27" \<br/> "https://librenms.example.com/api/v0/graphs/ports/peering,transit?width=1024&height=768&from=1405457456&to=1405543856&legend=no"</code></td>
|
||||
<td colspan="5"><code>curl -H "Content-Type: application/json" -H "X-Auth-Token: 91c60e737e342c205be5bba8e2954d27" \<br/> "https://librenms.example.com/api/v0/portgroups/peering,transit?width=1024&height=768&from=1405457456&to=1405543856&legend=no"</code></td>
|
||||
</tr>
|
||||
<a name="list"></a>
|
||||
<tr class="success">
|
||||
|
||||
Reference in New Issue
Block a user