Introduction to the cPanel API
There are several APIs available for interacting with the cPanel software on your server.
With so many options, it's easy for users to become confused as to which API they should use for a given purpose. This document attempts to clarify this issue by explaining the cPanel APIs and their most common uses.
Important: If you wish, you can integrate API1 and API2 functions into remote applications by using the
cpanel function call in the XML or JSON API. You can read more about this
here.
API1
This API is used mainly to add, modify, or delete data on the server.
Here are a few useful facts that distinguish API1 from other APIs:
- This API ordinarily prints data to the cPanel interface. As such, it's useful for creating themes or skins.
- API1 functions work well when they are called via cpanel tags. They are useful for adding, modifying, and deleting data.
- These functions sometimes return inline HTML, rather than XML. If you send this output to an XML parser, it will not function.
- In a few cases, API2 functions overlap with API1 functions. In those cases, using the API2 functions is preferred, since these are more up-to-date.
API2
API2 functions, like API1 functions, are designed to generate output compatible with browsers. However, unlike API1, API2 is used mainly to return data.
Here are a few useful facts that distinguish API2 from other APIs:
- These functions normally return data structures, rather than performing any modifications on the server.
- API2 uses a templating system to print data to the cPanel interface.
- API2 functions will return useful data when called via our XML API, or livePHP or CGI scripts.
- In a few cases, API2 functions overlap with API1 functions. In those cases, using the API2 functions is preferred, since these are more up-to-date.
The XML and JSON APIs
These APIs generate output in either XML or JSON. They are designed to allow you to use WHM via your own software, whereas API 1 and API 2 specifically target cPanel.
Here are a few useful facts about our XML and JSON APIs:
- These functions return data structures in XML and JSON and allow you to make modifications to the server.
- These functions are intended to be used remotely.
- There are several possible applications of the XML and JSON APIs. For example, they can make managing a data center easy by allowing you to issue a single command across multiple servers.
- You can use the XML and JSON APIs to call API 1 and API 2 functions directly.
The Manage 2 API
The Manage2 API allows you to automate procedures surrounding license management. You can use the Manage 2 API to create a script that retrieves and manipulates licensing information. You can choose to return Manage 2 API data in 3 different formats. This allows you to build a customizable interface or simplify license management to the execution of a script through a browser.
Some useful facts about our Manage 2 API:
- Allows you to perform most of the actions required for managing your licenses.
- Our manage 2 API can return data in XML, JSON, or YAML format.
Resources
| Document |
Description |
| API version 1 |
This document contains information about how to call API version 1 (also known as API 1. This version of our API was designed to generate output compatible with web browsers. You can use this API to add, modify, and delete data on your server. |
| API version 2 |
This document contains information about how to call API version 2 (also known as API 2. This version of our API was also designed to generate output compatible with web browsers but can only be used to return data. |
| API 1 Functions |
These documents describe each API 1 function and module. cPanel uses the API 1 system to add, modify, or delete data on the server. API 1 functions print data to the cPanel interface, making them useful for creating themes or skins. This document describes each API 1 function and module. |
| API 2 Functions |
These documents describe each API 2 function and module. The API 2 system uses its own custom templating system to display output. API 2 is more flexible but considerably more complicated than API 1. |
| XML and JSON API |
This version of our API allows you to manipulate WHM. |
| Manage 2 API |
Our Manage 2 API allows you to manage your licenses. |
Topic revision: r8 - 17 Aug 2011 - 15:26:14 - Main.JustinSchaefer