Added the ability to call the api for a list of endpoints

This commit is contained in:
Neil Lathwood
2014-10-09 16:20:04 +00:00
parent 88fb66c774
commit 0be049fde9
2 changed files with 13 additions and 0 deletions

View File

@ -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);
}