NAME

cPanel::APIClient - cPanel APIs, à la TIMTOWTDI!

SYNOPSIS

Create a cPanel::APIClient::Service::cpanel object to call cPanel APIs:

my $cpanel = cPanel::APIClient->create(
    service => 'cpanel',
    transport => [ 'CLISync' ],
);

my $resp = $cpanel->call_uapi( 'Email', 'list_pops' );

my $pops_ar = $resp->get_data();

Create a cPanel::APIClient::Service::whm object to call WHM APIs:

my $whm = cPanel::APIClient->create(
    service => 'whm',
    transport => [ 'CLISync' ],
);

my $resp = $whm->call_api1( 'listaccts' );

my $accts_ar = $resp->get_data();

DESCRIPTION

cPanel & WHM exposes a number of ways to access its APIs: different transport mechanisms, different authentication schemes, etc. This library provides client logic with sufficient abstractions to accommodate most supported access mechanisms via a unified interface.

This library intends to supersede cPanel::PublicAPI as the preferred way to access cPanel & WHM’s APIs from Perl. It can also serve as a model for similar client libraries in other languages.

FEATURES

CHARACTER ENCODING

cPanel & WHM’s API is character-set-agnostic. All text that you give to this library should thus be encoded to binary, and all strings that you’ll receive back will be binary.

This means that if you character-decode your inputs—as perlunitut recommends—then you’ll need to encode your strings back to bytes before giving them to this module.

Use of UTF-8 encoding is strongly recommended!

FUNCTIONS

$client = cPanel::APIClient->create( %OPTS )

A factory function that creates a “client” object that your code can use to call the APIs.

%OPTS are:

Depending on the service given, this function returns an instance of either cPanel::APIClient::Service::cpanel or cPanel::APIClient::Service::whm.

LICENSE

Copyright 2020 cPanel, L. L. C. All rights reserved. http://cpanel.net

This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.