Perl Requires Chilkat v11.0.0+
Chilkat2 Perl
BrickLink OAuth1 using Chilkat HTTP
See more BrickLink Examples
Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
my $http = Chilkat2::Http->new;
$http->OAuth1(1);
$http->OAuthConsumerKey('Your Consumer Key');
$http->OAuthConsumerSecret('Your Consumer Secret');
$http->OAuthToken('Your OAuth1 Token');
$http->OAuthTokenSecret('Your Token Secret');
$http->OAuthSigMethod('HMAC-SHA1');
my $resp = Chilkat2::HttpResponse->new;
my $success = $http->HttpNoBody('GET', 'https://api.bricklink.com/api/store/v1/orders?direction=in', $resp);
if (!$success) {
print $http->LastErrorText, "\n";
exit;
}
print 'Response status code = ', $resp->StatusCode, "\n";
my $json = Chilkat2::JsonObject->new;
$resp->GetBodyJson($json);
$json->EmitCompact(0);
print $json->Emit(), "\n";