Note: This API is only for whmphp version 5 and above.
For WHMCS Module please refer this page
Right now, the API functions are designed only for Master Resellers to perform operation on their resellers
API URL : http://serverip:2082/frontend/x3/master/api.php , where x3 is the cPanel theme of the account.
Method : POST or GET
Example usage ( Logic )
Required values : cPanel username, ServerIP/domain, cPanel password.
Conditions : The user must have Reseller as well as Master Reseller permission
Connect to WHM XML API and get user's cPanel theme
Connect to cPanel WHMPHP api and call the function
Example Usage ( PHP code )
<?php
$serverip ="serveriphere" ;
$cpanel_username = "user" ;
$cpanel_password = "password" ;
$request = "/xml-api/accountsummary?user=$cpanel_username";
$output = connect_whm(
$request,$serverip,$cpanel_username,$cpanel_password) ;
/* connect_whm is a function that will connect to WHM using the username/password provided and return the XML result as Array
*/
$theme = $output['accountsummary']['acct']['theme']; // x,x2,x3,x3mail or xmail
$request = "/frontend/$theme/master/api.php?action=listresellers";
$output = connect_cpanel($request,$serverip,$cpanel_username,$cpanel_password) ;
/* as you can guess, connect_cpanel is a function that will connect to the users cPanel account and get the XML result from the whmphp api as array
if ($output['whmphp']['status'])
{
// Success, do whatever you want here
echo $output['whmphp']['statusmsg']; // return succes message
}
else
{
// failed, so return the error
echo $output['whmphp']['statusmsg'];
}
?>
Create Reseller
| Input | action | createreseller |
| domain | Doman name of reseller | |
| username | Username of reseller | |
| password | Password of reseller | |
| Email Address of reseller | ||
| package | Package Name | |
| Output | ||
| statumsg | Normal cPanel account creation messages | |
| status | 0/1 |
List Resellers
| Input | action | listresellers |
| Output | ||
| reseller | list of resellers |
Suspend Reseller
| Input | username | Username of reseller* |
| action | suspendreseller | |
| Output | ||
| statumsg |
|
|
| status | 0/1 |
Unsuspend Reseller.
| Input | username | Username of reseller* |
| action | unsuspendreseller | |
| Output | ||
| statumsg |
|
|
| status | 0/1 |
Terminate Reseller
| Input | username | Username of reseller* |
| action | terminatereseller | |
| Output | ||
| statumsg |
|
|
| status | 0/1 |
Change Reseller Password
| Input | username | Username of reseller* |
| password | New password | |
| action | changepwd | |
| Output | ||
| statumsg |
|
|
| status | 0/1 |
Set Limits and Overselling
| Input | username | Username of reseller* |
| action | setlimit | |
| limit | Interger | |
| band | Interger | |
| disk | Interger | |
| oversell_disk | Boolen ( 0 - disable , 1 - enable ) | |
| oversell_bw | Boolen ( 0 - disable , 1 - enable ) | |
| ns1 | String | |
| ns2 | String | |
| Output | ||
| statumsg |
|
|
| status | 0/1 |
