Overview
If you are a SitePad NOC and want to automate SitePad License management you can do that easily with the SitePad NOC API.
Download
The SitePad NOC API is available only to the NOCs and you can download it from the NOC Panel :
http://www.softaculous.com/clients?ca=download_api
There are many examples at the bottom of the API file to test.
Examples
Here are a few examples to manage SitePad Licenses.
NOTE : You should include the NOC API file that you just downloaded. And initiate the Class using your NOCusername and NOCpassword.
include_once 'noc_api.inc'; $noc = new SOFT_NOC('username', 'password');
If you want SitePad to use JSON for handling the data please add the following variable :
$noc->json = 1;
Purchase/Renew SitePad Licenses
$noc->r($noc->sitemush_buy('188.188.188.188', '1M', 1));
- 1st Parameter : Your server's IP
- 2nd Parameter : The period for which you wish to renew. 1M will extend by one months, 3M will extend by three months, 1Y will extend by One year. Possible values 1M, 3M, 6M, 9M, 1Y, 2Y, 3Y
- 5th Parameter : Auto Renew 1 to enable auto renew and 0 to disable auto renew.
List SitePad License Details
$noc->r($noc->sitemush_licenses());
- All Parameters are optional. If no parameter is passed it will list the details of all the licenses under your account.
- 1st Parameter : License Key. This will search by License key.
- 2nd Parameter : Server IP. This will search by Server IP.
- 3rd Parameter : Expiry date. Possible values 1, 2, 3.
- 1 - All Expired Licenses under your account
- 2 - Expiring in 7 Days
- 3 - Expiring in 15 Days
- 4th Parameter : Start value. This is the start limit of the number of licenses you wish to list. Eg you wish to list the licenses from 100th license pass the value as 99.
- 5th Parameter : Length of return from start value. This is the number of licenses you wish to list from the start value. Eg you wish to list the 100th licenses pass the start value as 99 and length value as 1.
- 6th Parameter : Authorized Email. This will list the licenses with the provided email.
Edit IP of a SitePad License
$noc->r($noc->sitemush_editips(1000, '198.198.198.198')); // LID and new IP Address
- 1st Parameter : License ID. You can get the license id from the sitemush_licenses() function.
- 2nd Parameter : New IP. This is the new IP to be assigned for the provided license.
SitePad License Logs
Search Logs by License Key :
$noc->r($noc->sitemush_licenselogs('SMUSH-88888-88888-88888-88888'));
- 1st Parameter : License Key for which you need license logs.
OR
Search Logs by License IP
$noc->r($noc->sitemush_licenselogs('', 0, '188.188.188.188'));
- 1st Parameter : Empty
- 2st Parameter : 0 (Default Value)
- 3st Parameter : License IP for which you need license logs.
SitePad Auto Renewals
$noc->r($noc->sitemush_renewals());
- All Parameters are optional. If no parameters are passed it will list all the licenses with Auto Renewals under your account.
- 1st Parameter : License Key. This will search by License key.
- 2nd Parameter : Server IP. This will search by Server IP.
- 3th Parameter : Start value. This is the start limit of the number of licenses you wish to list. Eg you wish to list the licenses from 100th license pass the value as 99.
- 4th Parameter : Length of return from start value. This is the number of licenses you wish to list from the start value. Eg you wish to list the 100th licenses pass the start value as 99 and length value as 1.
Add SitePad Auto Renewal
$noc->r($noc->sitemush_addautorenewal('SMUSH-88888-88888-88888-88888'));
- 1st Parameter : License Key for which you want to enable Auto Renewal.
Cancel SitePad Auto Renewal
$noc->r($noc->sitemush_removeautorenewal('SMUSH-88888-88888-88888-88888'));
- 1st Parameter : License Key for which you want to disable Auto Renewal.
Refund a Transaction
$noc->r($noc->sitemush_refund(100));
- 1st Parameter : Action ID for which you wish to claim a Refund. You can get the action id from the sitemush_licenselogs() function.
Cancel SitePad License
$noc->r($noc->sitemush_remove('SMUSH-88888-88888-88888-88888'));
- 1st Parameter : License Key for which you want to cancel license.
Refund and Cancel SitePad License
This function will first refund all the eligible transactions and then cancel the license.
$noc->r($noc->sitemush_refund_and_cancel('SMUSH-88888-88888-88888-88888', '198.198.198.198'));
- Only one parameter is compulsory. You can pass any one parameter.
- 1st Parameter : License Key for which you want to refund and then cancel license.
- 2nd Parameter : Server IP for which you want to refund and then cancel license.
Debugging
- If there are any Errors while executing the above tasks the Errors will be returned in the $noc->error variable. You can print the errors :
$noc->r($noc->error);
- If the above variable is empty then the tasks were completed without any errors.
Output in XML
- You can also convert the output to XML.
$data = $noc->sitemush_licenses(); echo ArrayToXML::toXML($data);
- This will display the data in XML format.
Output in JSON
- You can also convert the output to JSON.
$data = $noc->sitemush_licenses(); echo array2json($data);
- This will display the data in JSON format.