netskope/ntskp-api-03.pl

22 lines
713 B
Perl
Executable File

#!/usr/bin/perl -w
use 5.024;
use strict;
use warnings;
use autodie;
use Config::Tiny;
use HTTP::Tiny;
#use Cpanel::JSON::XS;
use JSON::PP;
my $CONFIG_FILE = "/home/mischa/netskope/netskope.cnf";
my $config = Config::Tiny->read($CONFIG_FILE, 'utf8');
my $NTSKP_TENANT = $config->{netskope}->{NTSKP_TENANT};
my $NTSKP_TOKEN = $config->{netskope}->{NTSKP_TOKEN};
my $NTSKP_PERIOD = $config->{netskope}->{NTSKP_PERIOD};
my $uri = "$NTSKP_TENANT/api/v1/events?token=$NTSKP_TOKEN&type=page&timeperiod=$NTSKP_PERIOD";
my $response = HTTP::Tiny->new->get($uri);
#my $json = Cpanel::JSON::XS->new->indent(1)->encode($response->{content});
my $json = JSON::PP->new->pretty(1)->encode($response->{content});
print $json;