Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Standardized Hooks

The Standardized Hooks System is useful for developers and administrators who want to automatically trigger a script or application when a specific action is performed in cPanel & WHM. It allows you to customize the way cPanel & WHM functions under generic or specific scenarios. Having this fine-grain control allows more flexibility when implementing cPanel & WHM systems and the end-user functionality therein.

This system is only available in cPanel & WHM versions 11.32 and later.

Document Description
Introduction A brief introduction to standardized hooks.
Taxonomy An in-depth looking into the components of the Standardized Hooks System.
Getting Started Learn the key elements you will need to know to use cPanel's standardized hooks.
Hooks Management Interface The Standardized Hooks management utility allows you to maintain a registry of the Standardized Hooks associated with your cPanel &WHM system.
Hookable Events Hookable events are specific points in cPanel & WHM events where you are allowed execute custom code.
Advanced Usage You can do more than just execute code with standardized hooks. This document provides additional information about this system's advanced features.
Troubleshooting This document covers very basic information about troubleshooting Standardized Hooks. For more in-depth troubleshooting help, please visit forums.cpanel.net or open a support ticket.

AppConfig

This document describes a cPanel subsystem that can allow you to affect a PHP application served from within cPanel, WHM, or webmail.

Document Description
AppConfig In cPanel & WHM 11.32, we added the ability to specify two low-level PHP handling attributes when cPanel, WHM, or webmail serves a PHP application.

cPanel & WHM's API

Our API allows you to access cPanel & WHM functionality from your own integrated or external applications. These documents describe how to use our API functions.

Basics
Introduction Basic information about our application programming interface (API).
Authenticating API Function Calls 2 methods you can use to authenticate API function calls.
cPanel Template Toolkit cPanel Template Toolkit is a template-driven parser for API2 calls. This document describes how to use the cPanel Template Toolkit.
Internal API  
Calling Unified API (UAPI) Functions Learn how to call UAPI functions directly. If you plan to make your application compatible with all future versions of cPanel & WHM, you should use our LiveAPI system whenever possible.
Using API 1 Functions Learn how to call API 1 functions directly using cPanel tags. cPanel tags are supported but will eventually be phased out. If you plan to make your application compatible with all future versions of cPanel & WHM, you should use our LiveAPI system whenever possible.
Using API 2 Functions This document describes how to call API 2 functions in cPanel tags. cPanel tags are supported but will eventually be phased out. If you plan to make your application compatible with all future versions of cPanel & WHM, you should use our LiveAPI system whenever possible.
Using API 1 & 2 Functions via XML API You can call API 1 and API 2 functions using our XML API.
UAPI Functions A reference list of UAPI functions and modules.
API 1 Functions A reference list of API 1 functions and modules.
API 2 Functions A reference list of API 2 functions and modules. When coding for the cPanel interface, the API 2 system can utilize a custom templating system, based on Template Toolkit, to display data returned by the functions. API 2 is much more flexible than API 1, but requires more sophisticated coding. We recommend using API 2 whenever possible.
Whostmgr::XMLUI::cPanel Perl Module The Whostmgr::XMLUI::cPanel module allows you to execute cPanel API 1 and API 2 functions natively from within your Perl applications.
External API  
XML and JSON API Our XML and JSON APIs allow you to interact with WHM.
Parsing XML Data Learn how to parse XML output.
Manage 2 API Our Manage 2 API allows you to manage your licenses.
API Privilege Escalation You can temporarily escalate a user's privileges while using API calls.

Modules and Plugins

You can create cPanel modules and plugins to extend cPanel's functionality. WHM plulgins allow you to add new functionality to WHM. These documents explain how to create modules and plugins for cPanel & WHM.

cPanel Modules
Installing Perl Modules Instructions to install your own internal Perl modules.
Writing cPanel Modules Modules are software components that you can add to cPanel to extend cPanel's functionality.
The PHP Accounting Module Learn how to use access keys with cPanel's PHP accounting module.
The cPanel::Accounting Perl Module Learn how to use remote access keys with the cPanel::Accounting Perl module.
Writing cPanel Plugins  
cPanel Plugins cPanel Plugins allow you to integrate third-party applications with cPanel. You can use plugins to add links to your users' cPanel interfaces.
LiveAPI This document covers some basic information about the LiveAPI system. The LiveAPI system is a growing body of work that will make creating software with cPanel & WHM's API and interpreted languages, such as Perl or PHP, much easier.
  • LiveAPI PHP Class — The LiveAPI PHP class is a PHP framework you can use within cPanel. This framework provides PHP scripts with a local socket to the cPanel binary, cpsrvd, allowing your script to make API1 and API2 calls to the local machine via the socket.
  • LiveAPI Perl Module — The LiveAPI Perl Module provides Perl scripts with a local socket to the cPanel binary, cpsrvd.
cPanel CGI Scripts CGI scripts can be very useful when you need more flexibility than cPanel's other integration methods allow. This document describes where and how to create your CGI script.
Plugin Variables This page documents the variables available within cPanel's HTML logic and DynamicUI files.
DynamicUI Reference Charts You can use these charts as a reference guide whenever adding items to your cPanel interface.
Installing cPanel Plugins cPanel plugins must be installed and used in a specific way. You can learn about installing cPanel plugins here.
Adding Icons and Groups Learn about adding icons and groups to the cPanel interface.
Plugin Installation File Generator You will need to generate an installation file for your plugins.
Plugin Security Policy cPanel's plugin security policy: Information for implementing multi-layer authentication for WHM, cPanel, and Webmail.
Using PHP in a cPanel Plugin's Interface For cPanel & WHM 11.30 and older versions of cPanel & WHM — We have refactored this system so that it applies to an expanding list of scripting languages. You should review our LiveAPI documentation for the most recent information. cPanel allows for additional pages to be written in PHP rather than straight HTML. This document describes using PHP to generate a cPanel plugin's interface.
WHM Plugins  
Creating WHM Plugins You can create WHM plugins that extend WHM's functionality.
ACL Reference Table You can find our access control reference table here.
Pluggable WHM ACLs Information about pluggable WHM ACLs.
The swapip Utility Though it does not reside in the /scripts directory, this tool allows you to update the IP address in a DNS zone record.
The cPanel Logger Module The Cpanel::Logger module can be used to raise error messages in a custom event handler. This module provides a common interface for logging to files, such as cPanel's error_log.
Pluggable dnsadmin Modules You can create pluggable dnsadmin modules that automate tasks in your DNS cluster. This set of documents describes how to create these modules.
Package Extensions You can create extensions to add to hosting packages, with editable variables that are visible in WHM.
EasyApache Modules  
Custom Modules You can add features to EasyApache by developing custom modules.

cPAddons (Site Software)

cPAddons allow you to add functionality to the cPanel interface.

cPAddons
Introduction If you're new to cPAddons, this document will introduce you to some basic concepts.
Creating cPAddons Step-by-step instructions for creating a cPAddon.
Creating cPAddon Upgrades cPAddon upgrades are new versions of a cPAddon script. This document offers step-by-step instructions for creating an upgrade.
Using Hash References with cPAddons A reference of hash keys accepted by the cPAddon's installation configuration files.
Using Custom Installation Fields with cPAddons Add custom installation fields to a cPAddon's installation configuration files.
Configuration File Variables Learn how to set and manage configuration file variables.
Creating Invisible cPAddon Scripts If you create a cPAddon that is associated with another cPAddon, or should not appear to all users, you can create an invisible cPAddon script.
cPAddon Aliases If a cPAddon should fit into more than one category, you can create an alias.
Licensing cPAddons Learn about using commercial licenses with your cPAddons.
Distributing cPAddons Learn how to distribute your cPAddons through the WHM interface.

Advanced System Administration

Advanced system administrators may find the following information useful.

Advanced System Administration
TailWatch TailWatch is a process that handles the tasks previously handled by three separate processes: eximstats, antirelayd, and cpbandwd.
Integrating Custom Webmail Applications You can add your favorite custom webmail applications to cPanel.
Troubleshooting Perl Here are some basic troubleshooting methods you can use when you encounter problems using Perl.

cPanel Hooks

For cPanel & WHM 11.30 and older versions of cPanel & WHM

As of cPanel & WHM 11.32, we have refactored this system so that it applies sanity checks to your software. You should review our Standardized Hooks documentation for the most recent information.

These documents explain how to hook into cPanel's functionality. You can run hooks before and after API calls. This will allow you to automate recurring tasks on a cPanel & WHM server.

cPanel Hooks
Introduction This document will get you started on the various methods of hooking into cPanel's functionality.
Writing Function Hooks Function hooks allow you to automatically perform actions after an API 1 or API 2 function is executed. These scripts are placed in /usr/local/cpanel/hooks and receive XML via STDIN from parent cPanel processes.
Script Hooks cPanel & WHM script hooks allow for custom code to be executed for certain system-level operations such as account modifications, installation of server software, and backup runs.
Custom Event Handlers A custom event handler is a powerful tool that allows you to access operations triggered by the cPanel interface. You can create custom event handlers as pre and post event handlers—meaning that the action is taken before or after an API function executes.
The cPanel Logger Module You can use the Cpanel::Logger module to raise error messages in a custom event handler.
Universal Password Trap As a cPanel account password can be changed in a number of places, including both cPanel and WHM, we've created a universal hook that fires anytime an account password is changed.
EasyApache Hooks Using EasyApache, you can automatically perform actions before or after rebuilding Apache.
RPM::Versions Hooks RPM::Version hooks allow you to execute custom code whenever an RPM installs, updates, or uninstalls.

Developer Software

This section contains all of our developer software. This software includes packages and libraries, utilities, API clients, and code examples.

Packages and Libraries
API Clients  
PHP XML-API class This download provides a PHP class designed for easy automation of the XML API from within PHP scripts.
PublicAPI in PHP PublicAPI is a set of language-agnostic methods for interacting with cPanel systems. The PublicAPI PHP client class is a PHP implementation of our PublicAPI system. The client supports all of the methods used by the Public API interface, in addition to most of the methods available in our previous PHP client classes, such as the XML-API client class.
PublicAPI in Perl PublicAPI is a set of language-agnostic methods for interacting with cPanel systems. The PublicAPI Perl client class is a Perl implementation of our PublicAPI system.
Developer Utilities  
API Tracer This CustomEventHandler allows you to trace API calls made in cPanel along with their input and output data.
PICK Important: This should only be run on development servers.
Examples  
Frontend Customization This file contains an example of how to build an email account creation page.
Backend Customization This download contains a description of how to create a CustomEventHandler that implements email blacklisting, including proper error returning from within the CustomEventHandler system.

Topic revision: r44 - 07 Oct 2013 - 19:39:17 - Main.SarahHaney