Skip to content

Instantly share code, notes, and snippets.

@delphinus
Created September 11, 2012 10:02
Show Gist options
  • Select an option

  • Save delphinus/3697356 to your computer and use it in GitHub Desktop.

Select an option

Save delphinus/3697356 to your computer and use it in GitHub Desktop.
Woopra API sample
#!/usr/bin/env perl
use strict;
use warnings;
use Date::Manip;
use LWP::Simple;
use JSON;
use YAML;
use URI;
my $uri = URI->new('http://api.woopra.com/rest/analytics/get.jsp');
$uri->query_form(
website => 'blog.remora.cx',
api_key => 'SWUKTD19Y1',
format => 'json',
date_format => 'yyyy/MM/dd',
start_day => UnixDate('-30 days', '%Y/%m/%d'),
end_day => UnixDate(now => '%Y/%m/%d'),
query => q!SELECT visits.count FROM cloud GROUP BY 'info.browser'!,
);
print $uri->as_string;
my $result = get $uri->as_string;
my $json = from_json($result);
print Dump $json;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment