Child pages
  • Guide to the LiveAPI System - The api() Method
Skip to end of metadata
Go to start of metadata

 

Description

The api() method executes a cPanel API 1 or cPanel API 2 function.

Important:

We strongly recommend that you use the appropriate method for the chosen API (api1() or api2()), rather than this method. These API-specific methods use additional internal logic to integrate with cPanel & WHM.

Example  


LiveAPI PHP Class

// Execute the Email::listpopswithdisk function.
$cpanel->api(
    'exec','2','Email', 'listpopswithdisk', 
    array(
        'domain'          => 'example.com',
        'nearquotaonly'   => '0',
        'no_validate'     => '0',
    ) 
); 

LiveAPI Perl Modul e

# Execute the Email::listpopswithdisk function.
$cpliveapi->api(
   'exec','2','Email','listpopswithdisk',
   {
        'domain'                 => 'example.com',
        'api2_filter'            => '1',
        'api2_filter_column'     => 'diskquota',
        'api2_filter_term'       => '350',
        'api2_filter_type'       => 'lt_handle_unlimited',
    }
);

Parameters

ParameterTypeDescriptionPossible valuesExample
typestringThe request type.execexec
versionintegerThe cPanel API version.
  • 1 — Execute a cPanel API 1 function.
  • 2 — Execute a cPanel API 2 function.
2
modulestringThe module name.A cPanel API 1 or cPanel API 2 module name.Email
funcstringThe function name.A cPanel API 1 or cPanel API 2 function name.listpopswithdisk
arguments

array

or

hash

The function's input parameters and values.
  • For cPanel API 1 functions, this is an array or array reference.
  • For cPanel API 2 functions, this is a hash or hash reference.
 Click to view...
   'domain'             => 'example.com',
'api2_filter' => '1',
'api2_filter_column' => 'diskquota',
'api2_filter_term' => '350',
'api2_filter_type' => 'lt_handle_unlimited',

Returns

This method returns a hash reference of the function's output.

For detailed output information, read the function's documentation.