Client Operations API

This API offers instant and secure ways to close a client's account or rename a client's account to a different unique id.

Overview

This API is used to perform general client account operations, such as closing or renaming a client's account, and finding how many upgrades the user has available.
Your server makes a request to SimpleScripts, and receives a success/failure message upon completion.

Features

FeatureIdentifierNotes
Rename an Accountrename_clientUse this feature to rename a client account from one unique id to another. This is useful if a client renames their hosting account with you, and you want their SimpleScripts installation data preserved across the rename.
Cancel an Accountcancel_clientThis feature will close a client's account, effective immediately. If the account is closed within a 45 day period after any Pro account fee has been processed, that fee will be credited to your account.
Count Available Upgradescount_upgradesThis feature will return the number of available upgrades for a specific client. Useful for alerting the customer on the panel end of potential security issues and new feature availability.

Rename Client

Renaming a client from one unique ID to another will preserve any installation data and account status. If you are currently supplementing this client, you will not be charged for setting up a new account.
KeyValueNotes
host_keyYour Host KeyYour Host Key is a unique identifier provided by SimpleScripts for tracking purposes. This key is used in all SimpleScripts APIs.
host_api_keyYour Host API KeyYour Host API Key is a special password required to use this and any other SimpleScripts API. Keep this password secure!
old_uniqueCurrent Unique Account IDThe existing host-wide unique id for the client. Can be the user's username (if unique among ALL of your servers) or an account id, etc.
new_uniqueNew Unique Account IDThe replacement for the existing unique ID.

Cancel Client

Cancelling a client will remove the client from our systems, including all existing installation data! If you are currently supplementing this client, and are within a 45 day window of the date the supplement was paid, cancelling the client will credit your account for the amount paid.
KeyValueNotes
host_keyYour Host KeyYour Host Key is a unique identifier provided by SimpleScripts for tracking purposes. This key is used in all SimpleScripts APIs.
host_api_keyYour Host API KeyYour Host API Key is a special password required to use this and any other SimpleScripts API. Keep this password secure!
old_uniqueCurrent Unique Account IDThe existing host-wide unique id for the client. Can be the user's username (if unique among ALL of your servers) or an account id, etc.

Sample Code

<?php
/* 
Sample Code for the SimpleScripts Client Ops API. 
Be sure to change "feature" below to either rename_client or cancel_client, 
and only enter the unique/old_unique+new_unique fields.
*/

//Gather all the necessary client information into one place.
//START EDITING HERE.
$my_request = array(
   "host_key" => "YOUR HOST KEY",
   "host_api_key" => "YOUR HOST API KEY",
   "feature" => "rename_client",
   "unique" => "UNIQUE CLIENT ID HERE", //for CANCEL account only!
   "old_unique" => "UNIQUE CLIENT ID HERE", //for RENAME account only! 
   "new_unique" => "UNIQUE CLIENT ID HERE", //for RENAME account only!
);
//STOP EDITING HERE.

//build the query.
$my_request_str = "";
foreach ($my_request as $key => $value) { $my_request_str.= $key."=".urlencode($value)."&"; }

//cPanel (and maybe other panels) come with a gutted version of PHP that does not 
//include the standard CURL libraries.  If your panel supports them, you can use those instead.
ob_start(); 
passthru('curl -k https://www.simplescripts.com/api/client_ops.php
	--data "'.rtrim($my_request_str,"& ").'" --max-time 60'); 
$response = ob_get_contents(); 
ob_end_clean();

//Take apart the response.  First part is the success/failure bit (1/0, respectively), 
//and the second is either a link to redirect to, or a failure message for debugging.
$parts = explode("|",$response);
if ($parts[0] == "0") { die("Something went wrong!<br />\n".$parts[1]); }
else {
   print 'Success';
}
?>

Return Values

A successful request (not necessarily a successful operation) will return a string concatenated with a pipe "|" symbol. Exploding the string on the pipe symbol will give you an array of parts, which are notated below. Note: Part Zero will always be a binary 0 or 1, depending on the operations failure or success, respectively.
SuccessPart 1Notes
0Secure Connection RequiredAll requests must use the https:// protocol when calling the SimpleScripts APIs.
0HostKey RequiredThis field is required. For more information, view the Definitions table above.
0HostAPIKey RequiredThis field is required. For more information, view the Definitions table above.
0Invalid HostKey/HostAPIKey CombinationJust like a bad username/password combination, this means you have provided bad information.
0Old/New Unique ID RequiredThe client's unique id is required. For more information, view the Definitions table above.
1UniqueID Does Not ExistThe specified Unique ID does not exist in our system. This returns successful!
1SuccessThe operation completed successfully.