Sample code for 30+ languages & platforms
Perl

qa.factura1.com.co Obtain Auth Token

See more HTTP Misc Examples

Demonstrates how to send a JSON POST to get an authenticataion token for qa.factura1.com.co

Chilkat Perl Downloads

Perl
use strict;
use warnings;
use Chilkat2;

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

my $http = Chilkat2::Http->new;

# Build the following JSON
# {
#   "password": "MY_PASSWORD",
#   "username": "MY_USERNAME"
# }

my $json = Chilkat2::JsonObject->new;
$json->EmitCompact(0);
$json->UpdateString('password', 'MY_PASSWORD');
$json->UpdateString('username', 'MY_USERNAME');

my $resp = Chilkat2::HttpResponse->new;
my $success = $http->HttpJson('POST', 'https://qa.factura1.com.co/v2/auth', $json, 'application/json', $resp);
if (!$success) {
    print $http->LastErrorText, "\n";
    exit;
}

my $jsonResp = Chilkat2::JsonObject->new;
$jsonResp->EmitCompact(0);
$jsonResp->Load($resp->BodyStr);

print $jsonResp->Emit(), "\n";

print 'Access token: ', $jsonResp->StringOf('token'), "\n";