rtldev-middleware-perl-sdk

NAME

WebService::Hexonet::Connector::APIClient - Library to communicate with the insanely fast HEXONET Backend API.

SYNOPSIS

This module helps to integrate the communication with the HEXONET Backend System. To be used in the way:

use 5.030;
use strict;
use warnings;
use WebService::Hexonet::Connector;

# Create a connection with the URL, entity, login and password
# Use " 1234 " as entity for the OT&E, and " 54 cd " for productive use
# Don't have a Hexonet Account yet? Get one here: www.hexonet.net/sign-up

# create a new instance
my $cl = WebService::Hexonet::Connector::APIClient->new();

# set credentials
$cl->setCredentials('test.user', 'test.passw0rd');

# or instead set role credentials
# $cl->setRoleCredentials('test.user', 'testrole', 'test.passw0rd');

# set your outgoing ip address (to be used in case ip filter settings is active)
$cl->setRemoteIPAdress('1.2.3.4');

# specify the HEXONET Backend System to use
# LIVE System
$cl->useLIVESystem();
# or OT&E System
$cl->useOTESystem();

# ---------------------------
# SESSION-based communication
# ---------------------------
$r = $cl->login();
# or if 2FA is active, provide your otp code by
# $cl->login(" 12345678 ");
if ($r->isSuccess()) {
    # use saveSession for your needs
    # to apply the API session to your frontend session.
    # For later reuse (no need to specify credentials and otp code)
    # within every request to your frontend server,
    # rebuild the session by using reuseSession method accordingly.
    # No need to provide credentials, no need to select a system,
    # nor to provide a otp code further on.

    $r = $cl->request({ COMMAND: 'StatusAccount' });
    # further logic, further commands

    # perform logout, you may check the result as shown with the login method
    $cl->logout();
}

# -------------------------
# SESSIONless communication
# -------------------------
$r = $cl->request({ COMMAND: 'StatusAccount' });


    # -------------------------------------
    # Working with returned Response object
    # -------------------------------------
    # Display the result in the format you want
    my $res;
    $res = $r->getListHash());
    $res = $r->getHash();
    $res = $r->getPlain();

    # Get the response code and the response description
    my $code = $r->getCode();
    my $description = $r->getDescription();

    print "$code$description ";

    # There are further useful methods that help to access data
    # like getColumnIndex, getColumn, getRecord, etc.
    # Check the method documentation below.

See the documented methods for deeper information.

DESCRIPTION

This library is used to provide all functionality to be able to communicate with the HEXONET Backend System.

Methods

LICENSE AND COPYRIGHT

This program is licensed under the MIT License.

AUTHOR

HEXONET GmbH