From aafd5a80db7b5ee27d1c432a4db93da48fbecb8a Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Fri, 4 Mar 2016 17:47:56 +0000 Subject: nms: Rename API end points and separate public/private --- web/nms.gathering.org/api/private/comments | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 web/nms.gathering.org/api/private/comments (limited to 'web/nms.gathering.org/api/private/comments') diff --git a/web/nms.gathering.org/api/private/comments b/web/nms.gathering.org/api/private/comments new file mode 100755 index 0000000..4adfb2b --- /dev/null +++ b/web/nms.gathering.org/api/private/comments @@ -0,0 +1,15 @@ +#! /usr/bin/perl +# vim:ts=8:sw=8 + +use lib '../../../../include'; +use nms::web; +use strict; +use warnings; + +my $query = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,state,username,id,comment from switch_comments natural join switches where state != \'delete\' order by time desc'); +$query->execute(); +while (my $ref = $query->fetchrow_hashref()) { + push @{$nms::web::json{'comments'}{$ref->{'sysname'}}{'comments'}},$ref; +} + +nms::web::finalize_output(); -- cgit v1.2.3