We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • Guide to Replacing cPanel API 1 Functions with UAPI Equivalents
Skip to end of metadata
Go to start of metadata

Introduction

This document lists the UAPI functions which replace previously-deprecated cPanel API 1 functions. We introduced UAPI in cPanel & WHM version 11.42. As we developed additional UAPI functions, we created equivalents to some cPanel API 1 functions.  Beginning with cPanel & WHM version 82, we started development for new UAPI modules and functions. These new modules and functions replace any cPanel API 1 functions without a current equivalent.

We are actively removing  the cPanel API 1 functions beginning in cPanel & WHM version 88. We strongly recommend that anyone using a cPanel API 1 function use a UAPI function instead.

Replace cPanel API 1 functions with UAPI equivalents

To retrieve a list of cPanel API 1 functions that custom integrations call your system, call the following WHM API 1 functions:

The following examples display code from a cPanel API 1 function and its UAPI equivalent. Click the tab below that corresponds to your chosen development language.

Note:

The examples below compare the cPanel API 1  SetLang::setlang  function and the UAPI  Locale::set_locale  function.

cPanel API 1 function
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Set the "en" locale for the account.
$new_language = $cpanel->api1(
	'SetLang', 'setlang', 
		array('en') 
); 


UAPI Function
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Set the "en" locale for the account.
$set_locale = $cpanel->uapi(
    'Locale', 'set_locale', 
    array(
        'locale' => 'en',
    ) 
);


Note:

For more information, read our Guide to the LiveAPI System.

cPanel API 1 function
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# Set the "en" locale for the account.
my $new_language = $cpliveapi->api1(
	'SetLang', 'setlang', 
		['en'] 
); 
UAPI function
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Set the "en" locale for the account.
my $set_locale = $cpliveapi->uapi(
    'Locale', 'set_locale',
    { 
        'locale' => 'en',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

For more information about how to replace a cPanel API 1 function with a UAPI function, read our Replace a cPanel API 1 Function With a UAPI Function documentation.

UAPI functions and legacy equivalents

The following tables list the UAPI functions that we added starting in cPanel & WHM version 82. The tables also list their cPanel API 1 equivalent functions.

For a complete list of UAPI functions and cPanel API 1 functions, read our  Guide to UAPI and Guide to cPanel API 1 documentation.

BoxTrapper

DenyIp

Fileman

Gpg

Htaccess

ImageManager

LogManager

MySQL®

Net

cPanel API 1 FunctionUPI Function
Net::dnslookup DNS::lookup

Park

PHP

PostgreSQL®

ServerInformation

SetLang

Important:

We removed the SetLang cPanel API 1 module in cPanel & WHM version 82.

Stats

StatsManager

SubDomain