API-Eulerian

 view release on metacpan or  search on metacpan

examples/edw/Rest.pl  view on Meta::CPAN

}
my $date_from = time() - 24 * 3600;
my $date_to = time();

my $cmd = File::Slurp::slurp($qfile);
$cmd =~ s/\[% SITE %\]/$site/gm;
$cmd =~ s/\[% DATE_FROM %\]/$date_from/gm;
$cmd =~ s/\[% DATE_TO %\]/$date_to/gm;


#
# Create a user specific Hook used to handle Analysis replies.
#

$h_setup{hook} = new API::Eulerian::EDW::Hook::Print();

my $peer = new API::Eulerian::EDW::Peer::Rest(\%h_setup);
my $status = $peer->request( $cmd );

if ( $status->error() ) {
  $status->dump();
  exit(1);
}

# Dump stages durations
$status->{ bench }->dump();

# Cancel the command
$peer->cancel();


1;
__END__

=head1 NAME

 Rest.pl - Sample EDW script for querying through REST

=head1 SYNOPSIS

 Rest.pl [optinos]

 Options :
  -help brief help message

=head1 OPTIONS

=over 8

=item B<-help>

 Print a brief help message and exists

=item B<--grid>

 Name of the grid on which your data is hosted.

=item B<--ip>

 The IP from which the call is going to be made and that will reach the EDW server.
 If not provided, will try to guess it through an external call.

=item B<--token>

 Authorization token provided through the Eulerian interface for accessing the Eulerian API.

=item B<--site>

 Name of the site as shown in the Eulerian Interface.

=item B<--query>

 Name of the query to send, needs to exist in examples/edw/sql/*.sql

=back

=head1 DESCRIPTION

 Query the EDW with the REST API.

=cut



( run in 1.256 second using v1.01-cache-2.11-cpan-39bf76dae61 )