summaryrefslogtreecommitdiff
path: root/eg/api.pl
blob: 4e89701965d792fff925974b454806be273e9782 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;
use 5.010;

use Net::HTTP::Spore;

my $username = shift;
my $token = shift;

my $api = Net::HTTP::Spore->new_from_spec(shift);

$api->enable('Net::HTTP::Spore::Middleware::Format::JSON');

$api->enable(
    'Net::HTTP::Spore::Middleware::Auth::Basic',
    username => $username,
    password => $token,
);

my ( $content, $result ) =
  $api->user_information( format => 'json', username => 'franckcuny' );

use YAML::Syck;
warn Dump $content;