NOC API

Overview

If you are a Softaculous NOC and want to automate Softaculous License management you can do that easily with the Softaculous NOC API or SDK.

Download

The Softaculous NOC SDK 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 SDK file to test.

Sandbox

If you would like to test the API in Sandbox mode before you go into production you can use the same NOC account username/password or apikey/apipass and just pass the sandbox parameter in your POST request.

PHP SDK Example

include_once 'noc_api.inc';
$noc = new SOFT_NOC('username', 'password');
$noc->sandbox = 1;
$noc->licenses();

CURL Example

curl -X POST -d 'json=1' -d 'sandbox=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' https://www.softaculous.com/clients?ca=softaculous

In order to check your sandbox licenses in Softaculous client area just toggle the Sandbox Mode Switch as shown in the screenshot below.

Note : Do not forget to remove sandbox mode from your code before you push it into production.

Examples

Here are a few examples to manage Softaculous Licenses. 

NOTE : If you plan to use SDK, you should include the NOC SDK 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 Softaculous to use JSON for handling the data please add the following variable :

$noc->json = 1;

Purchase/Renew Softaculous Licenses

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'purchase=1' -d 'ips=188.188.188.188' -d 'toadd=1M' -d 'servertype=1' -d 'authemail=test@test.com' -d 'autorenew=1' -d 'notes=Sample Note' https://www.softaculous.com/clients?ca=softaculous_buy
SDK
$noc->buy('188.188.188.188', '1M', 1, 'test@test.com', 1, 0, 'Sample Note');
  • 1st Parameter : Your server’s IP
  • 2nd Parameter : The period for which you wish to renew. 1M will extend by one months, 8M will extend by eight months, 1Y will extend by One year
  • 3rd Parameter : Server type 1 for Dedicated and 2 for VPS
  • 4th Parameter : Authorized email (You will get expiry notifications here)
  • 5th Parameter : Auto Renew 1 to enable auto renew and 2 to disable auto renew.
  • 6th Parameter : Purchase SitePad license for the same IP 1 to purchase the SitePad license and 0 if you do not wish to purchase the SitePad license.
  • 7th Parameter : (Optional) You can save notes which will help you identify your licenses

List Softaculous License Details

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' https://www.softaculous.com/clients?ca=softaculous

For filtered results you can use any of the following parameters

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'ips=188.188.188.188' -d 'expiry=1' -d 'start=100' -d 'len=50' -d 'email=test@test.com' https://www.softaculous.com/clients?ca=softaculous
SDK
$noc->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 Softaculous License

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD'-d 'lid=1000' -d 'ips[]=198.198.198.198' -d 'editlicense=1' https://www.softaculous.com/clients?ca=softaculous_showlicense
SDK
$noc->editips(1000, '198.198.198.198');
  • 1st Parameter : License ID. You can get the license id from the licenses() function.
  • 2nd Parameter : New IP. This is the new IP for the provided license.

License Logs

Search Logs by License Key :

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'key=88888-88888-88888-88888-88888' https://www.softaculous.com/clients?ca=softaculous_licenselogs 
SDK
$noc->licenselogs('88888-88888-88888-88888-88888');
  • 1st Parameter : License Key for which you need license logs.

OR 
Search Logs by License IP

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'licip=198.198.198.198' https://www.softaculous.com/clients?ca=softaculous_licenselogs 
SDK
$noc->licenselogs('', 0, '198.198.198.198');
  • 1st Parameter : Empty
  • 2st Parameter : 0 (Default Value)
  • 3st Parameter : License IP for which you need license logs.

Auto Renewals

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' https://www.softaculous.com/clients?ca=softaculous_renewals

For filtered results you can use any of the following parameters

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'ips=198.198.198.198' -d 'start=100' -d 'len=50' https://www.softaculous.com/clients?ca=softaculous_renewals
SDK
$noc->autorenewals();
  • 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 Auto Renewal

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'addrenewal=1' https://www.softaculous.com/clients?ca=softaculous_renewals
SDK
$noc->addautorenewal('88888-88888-88888-88888-88888');
  • 1st Parameter : License Key for which you want to enable Auto Renewal.

Cancel Auto Renewal

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'cancelrenewal=1' https://www.softaculous.com/clients?ca=softaculous_renewals
SDK
$noc->removeautorenewal('88888-88888-88888-88888-88888');
  • 1st Parameter : License Key for which you want to disable Auto Renewal.

Refund a Transaction

CURL
curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'actid=100'  https://www.softaculous.com/clients?ca=softaculous_refund
SDK
$noc->refund(100);
  • 1st Parameter : Action ID for which you wish to claim a Refund. You can get the action id from the licenselogs() function.

Cancel Softaculous License

CURL

Cancel license by License Key

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'cancel_license=1'  https://www.softaculous.com/clients?ca=softaculous_cancel

Cancel license by Server IP

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'licip=198.198.198.198' -d 'cancel_license=1'  https://www.softaculous.com/clients?ca=softaculous_cancel

Note: If the license expires after more than one month you will receive an error to claim a refund first. If you would like to cancel the license anyway pass the force parameter

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'cancel_license=1' -d 'force=1'  https://www.softaculous.com/clients?ca=softaculous_cancel
SDK
$noc->cancel('88888-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 cancel license.
  • 2nd Parameter : Server IP for which you want to cancel license.
  • 3rd Parameter (Optional) : Pass this as 1 if you want to force cancel license without claiming a refund.

Refund and Cancel Softaculous License

This function will first refund all the eligible transactions and then cancel the license.

CURL

Step 1: Get the Action ID using the License Logs API

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'key=88888-88888-88888-88888-88888' https://www.softaculous.com/clients?ca=softaculous_licenselogs

Step 2: Claim a Refund

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'actid=100'  https://www.softaculous.com/clients?ca=softaculous_refund

Step 3: Cancel the License

curl -X POST -d 'json=1' -d 'nocname=NOC_USERNAME' -d 'nocpass=NOC_PASSWORD' -d 'lickey=88888-88888-88888-88888-88888' -d 'cancel_license=1' -d 'force=1'  https://www.softaculous.com/clients?ca=softaculous_cancel
SDK
$noc->refund_and_cancel('88888-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.
  • 3rd Parameter (Optional) : Pass this as 1 if you want to force cancel license without claiming a refund (if the refund is not eligible).

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->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->licenses();
echo array2json($data); 
  • This will display the data in JSON format.
Was this helpful to you?