Guide to the LiveAPI System - The api() Method

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

1
2
3
4
5
6
7
8
9
// Execute the Email::listpopswithdisk function.
$cpanel->api(
    'exec','2','Email''listpopswithdisk',
    array(
        'domain'          => 'example.com',
        'nearquotaonly'   => '0',
        'no_validate'     => '0',
    )
); 

LiveAPI Perl Modul e

1
2
3
4
5
6
7
8
9
10
11
# 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

Parameter

Type

Description

Possible values

Example

 type

 string

 The request type.

 exec

exec

 version

 integer

 The cPanel API version.

  • 1 — Execute a cPanel API 1 function.
  • 2 — Execute a cPanel API 2 function.

2

 module

 string

 The module name.

 A cPanel API 1 or cPanel API 2 module name.

Email

 func

 string

 The 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.
 

Returns

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

  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....