Tidy API entry points & doc; error if something other than image/png is asked for from portgroup graphs

This commit is contained in:
Paul Gear
2014-11-25 21:45:15 +10:00
parent 935e51d3c8
commit 9930670119
3 changed files with 19 additions and 12 deletions

View File

@ -377,9 +377,16 @@ function list_bgp() {
echo _json_encode($output);
}
function get_graph_by_group() {
function get_graph_by_portgroup() {
global $config;
$app = \Slim\Slim::getInstance();
if ($app->request->getMediaType() != "image/png") {
// we only support PNG graphs at the moment
$app->response->setStatus(406); // Not Acceptable
echo("<h3>Not Acceptable</h3>\n");
echo("<p>Only media type 'image/png' is provided at present</p>\n");
return;
}
$router = $app->router()->getCurrentRoute()->getParams();
$group = $router['group'];
$vars = array();