Skip to content
Last updated

Development Guides Home

Guide to Replacing cPanel API 1 Functions with UAPI Equivalents

This document lists the UAPI functions that replace previously-deprecated cPanel API 1 functions. As we developed additional UAPI functions, we created equivalents to some cPanel API 1 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. 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.

LiveAPI PHP Class

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',
    )
);

LiveAPI Perl Module

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. The tables also list their cPanel API 1 equivalent functions.

For a complete list of UAPI functions, read our Guide to UAPI documentation.

BoxTrapper

cPanel API 1 FunctionsUAPI Functions
BoxTrapper::changestatusBoxTrapper::set_status
BoxTrapper::fetchcfgfile
BoxTrapper::listmsgsBoxTrapper::list_email_templates
  • BoxTrapper::logcontrols
  • BoxTrapper::showlog
BoxTrapper::get_log
  • BoxTrapper::messageaction
  • BoxTrapper::multimessageaction
BoxTrapper::resetmsgBoxTrapper::reset_email_template
BoxTrapper::savecfgfileBoxTrapper::set_allowlist
BoxTrapper::saveconf
  • BoxTrapper::showautowhitelist
  • BoxTrapper::showemails
  • BoxTrapper::showfromname
  • BoxTrapper::showqueuetime
BoxTrapper::get_configuration
This function returns all of an account's BoxTrapper configuration settings.
BoxTrapper::showmessageBoxTrapper::get_message
  • BoxTrapper::showqueue
  • BoxTrapper::showqueuesearch
BoxTrapper::list_queued_messages
This function inherently has filtering capabilities.
  • BoxTrapper::status
  • BoxTrapper::statusbutton
BoxTrapper::get_status

ClamScanner

DenyIp

cPanel API 1 FunctionsUAPI Functions
DenyIp::adddenyipBlockIp::add_ip
DenyIp::deldenyipBlockIp::remove_ip

Fileman

cPanel API 1 FunctionsUAPI Functions
Fileman::restoredbBackup::restore_databases
Fileman::restorefilesBackup::restore_files
Fileman::restoreaf

Gpg

cPanel API 1 FunctionsUAPI Functions
Gpg::deletekeyGPG::delete_keypair
Gpg::exportkeyGPG::export_public_key
Gpg::exportsecretkeyGPG::export_secret_key
Gpg::genkeyGPG::generate_key
Gpg::importkeysGPG::import_key

Htaccess

ImageManager

cPanel API 1 FunctionsUAPI Functions
ImageManager::convertImageManager::convert_file
ImageManager::thumbnailImageManager::create_thumbnails
  • ImageManager::dimensions
  • ImageManager::hdimension
  • ImageManager::wdimension
ImageManager::get_dimensions
This function returns all of an image's dimensions.
ImageManager::scaleImageManager::resize_image

LogManager

cPanel API 1 FunctionsUAPI Functions
LogManager::listdownloadsLogManager::list_archives
LogManager::savesettingsLogManager::set_settings
LogManager::showsettingsLogManager::get_settings

MySQL®

cPanel API 1 FunctionsUAPI Functions
  • Mysql::listdbs
  • Mysql::listdbsopt
  • Mysql::number_of_dbs
Mysql::list_databases
Mysql::routinesMysql::list_routines
  • Mysql::listusers
  • Mysql::listusersopt
  • Mysql::number_of_users
Mysql::list_users
Mysql::updateprivsMysql::update_privileges

Net

cPanel API 1 FunctionsUAPI Functions
Net::dnslookupDNS::lookup

Park

cPanel API 1 FunctionsUAPI Functions
Park::disableredirectMime::delete_redirect
Park::getredirecturlMime::get_redirect
Park::setredirecturlMime::add_redirect

PHP

PostgreSQL®

cPanel API 1 FunctionsUAPI Functions
Postgres::deluserPostgresql::delete_user
  • Postgres::listdbs
  • Postgres::listdbsopt
Postgresql::list_databases
Postgres::listusersoptPostgresql::list_users

ServerInformation

cPanel API 1 FunctionsUAPI Functions
ServerInfo::servicestatusServerInformation::get_information

SetLang

Note:

We removed the SetLang cPanel API 1 module.

cPanel API 1 FunctionsUAPI Functions
SetLang::setlangLocale::set_locale
SetLang::listlangsoptLocale::list_locales

Stats

cPanel API 1 FunctionsUAPI Functions
  • Stats::analoglist
  • Stats::webalizer
  • Stats::webalizerftp
Stats::errlogStats::get_site_errors
Stats::showbandwidthStats::get_bandwidth

StatsManager

cPanel API 1 FunctionsUAPI Functions
StatManager::updateUserConfigStatsManager::save_configuration
StatManager::doFormStatsManager::get_configuration

SubDomain

cPanel API 1 FunctionsUAPI Functions
SubDomain::disablesubrdMime::delete_redirect
SubDomain::setsuburlMime::add_redirect
SubDomain::subdomainurlMime::get_redirect