diff --git a/html/api_v0.php b/html/api_v0.php index 44bcc59fe..174886323 100644 --- a/html/api_v0.php +++ b/html/api_v0.php @@ -40,6 +40,7 @@ $app->group('/api', function() use ($app) { $app->post('/devices', 'authToken', 'add_device');//api/v0/devices (json data needs to be passed) $app->delete('/devices/:hostname', 'authToken', 'del_device');//api/v0/devices (json data needs to be passed) }); + $app->get('/v0', 'authToken', 'show_endpoints');//api/v0 }); $app->run(); diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index f9829b2a1..e3de88d37 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -478,3 +478,15 @@ function get_vlans() { $app->response->headers->set('Content-Type', 'application/json'); echo _json_encode($output); } + +function show_endpoints() { + global $config; + $app = \Slim\Slim::getInstance(); + $routes = $app->router()->getNamedRoutes(); + foreach($routes as $route) { + $output[$route->getName()] = $config['base_url'].$route->getPattern(); + } + $app->response->setStatus('200'); + $app->response->headers->set('Content-Type', 'application/json'); + echo _json_encode($output); +}