Webuzo API
Overview
Webuzo API can be used to perform various functions in Webuzo like
Installing scripts, Upgrading installations, Importing installations,
List Installations, Backup installations, Restore backups, List Backups,
Remove installations, Delete backups, Download backups.
SDK Class
We also have a SDK made for Webuzo. You can find details from the SDK docs.
Enduser
Authenticating
You need to write your authentication code in this step i.e. depending on the programming language you use.
Our examples below will be in PHP and will use PHP's curl() functions.
Example
Here is an example.
$url = 'https://user:password@domain.com:2003/index.php?';
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Get response from the server.
$resp = curl_exec($ch);
Make sure you use this authentication while making any API call.
List Scripts
Key
| Value
| Description
|
---|
Authentication
| -
| You can use the Enduser Authenticating method. |
act
| blank or any
| Any act will do as this is available everywhere.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Get response from the server.
$resp = curl_exec($ch);
// Unserialize data
$res = unserialize($resp);
// The Installed scripts list is in the array key 'iscripts' print_r($res['iscripts']);
Install a Script
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| software, js, perl
| The value should be "software" to install PHP script, "js" to
install a JavaScript and "perl" to install a PERL script for softaculous
to perform the action of installing a software.
|
soft
| 26 (26 is the Script ID of WordPress)
| The value should be "SID" for softaculous to perform the action of installing a software. You can find the list of sid's here
|
POST |
softsubmit
| 1
| This will trigger the install
|
softdomain
| domain.com
| This is the domain on which you wish to install the script
|
softdirectory
| wp
| This is the sub-directory to install the script in. Leave it blank to install in root of the domain
|
softdb
| wp123
| This is the database name for the script. If the script does not require database you can leave this blank
|
dbusername
| wp123
| This is the database user
|
dbuserpass
| w1XRF28mq8
| This is the database password. You can generate a random password
|
hostname
| localhost
| This is the hostname of your MySQL server. You can enter your MySQL server IP if you have MySQL on a remote server
|
admin_username
| admin
| This is the admin account username for the installation
|
admin_pass
| pass
| This is the admin account password for the installation
|
admin_email
| admin@domain.com
| This is the admin account email address for the installation
|
language
| en
| Language for the installation. You can get the language codes from the respective install.xml
|
site_name
| My Blog
| Site Name for the installation
|
site_desc
| My WordPress Blog
| Site Description for the installation
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=software'.
'&soft=26';
$post = array('softsubmit' => '1',
'softdomain' => 'example.com', // Must be a valid Domain
'softdirectory' => 'wp', // Keep empty to install in Web Root
'softdb' => 'wpdb',
'dbusername' => 'dbusername',
'dbuserpass' => 'dbuserpass',
'admin_username' => 'admin',
'admin_pass' => 'adminpassword',
'admin_email' => 'admin@example.com',
'language' => 'en',
'site_name' => 'WordPress Site',
'site_desc' => 'My Blog'
);
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = unserialize($resp);
// Done ?
if(!empty($res['done'])){
print_r($res);
// Error
}else{
echo 'Some error occured';
print_r($res['error']);
}
Edit an Installation
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| editdetail
| The value should be "editdetail" for softaculous to perform the action of editing an installation.
|
insid
| 26_12345
| The installation ID that you want to edit. It can be fetched from List Installed Script |
POST
|
---|
editins
| 1
| This will trigger the edit function
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=editdetail'.
'&insid=26_12345';
$post = array('editins' => '1',
'edit_dir' => '/path/to/installation/', // Must be the path to installation
'edit_url' => 'http://example.com', // Must be the URL to installation
'edit_dbname' => 'wpdb',
'edit_dbuser' => 'dbusername',
'edit_dbpass' => 'dbuserpass',
'edit_dbhost' => 'dbhost'
);
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = unserialize($resp);
// Done ?
if(!empty($res['done'])){
print_r($res);
// Error
}else{
echo 'Some error occured';
print_r($res['error']);
}
// Print the entire output just incase !
print_r($res);
Upgrade an Installed Script
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| upgrade
| The value should be "upgrade" for softaculous to perform the action of upgrading an installation.
|
insid
| 26_12345
| The installation ID that you want to upgrade. It can be fetched from List Installed Script |
POST
|
---|
softsubmit
| 1
| This will trigger the upgrade
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=upgrade'.
'&insid=26_12345';
$post = array('softsubmit' => '1');
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = unserialize($resp);
// Done ?
if(!empty($res['done'])){
// There might be some task that the user has to perform
if(!empty($res['setupcontinue'])){
echo 'Please visit the following URL to complete upgrade : '.$res['setupcontinue'];
// It upgraded
}else{
echo 'Upgraded successfully. URL to Installation : '.$res['__settings']['softurl'];
}
// Error
}else{
echo 'Some error occured';
print_r($res['error']);
}
// Print the entire output just incase !
print_r($res);
Remove an Installed Script
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| remove
| The value should be "remove" to perform the action of removing an installed script.
|
insid
| 8 (Installation ID)
| Installation ID of the installed script. It can be fetched from List Installed Script |
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=remove'.
'&insid=8';
$post = array('removeins' => '1');
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
Import an Installation
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| import
| The value should be "import" to perform the action of importing an installation.
|
soft
| 26 (26 is the Script ID of WordPress)
| The value should be "SID" for softaculous to perform the action of installing a software. You can find the list of sid's here
|
POST
|
---|
softdomain
| example.com
| This will be the domain where your script is installed. Domain should be without http:// or https://
|
softdirectory
| wp
| (OPTIONAL) This will be the directory under the domain where your
script is installed. Leave this blank if the script is installed in the
root of domain.
|
softsubmit
| 1
| This will trigger the import function.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=import'.
'&soft=26';
$post = array('softsubmit' => 1,
'softdomain' => 'example.com',
'softdirectory' => 'wp');
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
List Installed Script
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| installations
| The value should be "installations" to perform the action of listing installations.
|
showupdates
| true
| (OPTIONAL) The value should be "true" if you want to list only
installations that have an update available for softaculous to perform
the action of listing installations.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=installations';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = unserialize($resp);
// Done ?
if(!empty($res['done'])){
print_r($res['installations']);
// Error
}else{
echo 'Some error occured';
print_r($res['error']);
}
List Backups
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| backups
| The value should be "backups" to perform the action of listing backups.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=backups';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = unserialize($resp);
// Done ?
if(!empty($res['done'])){
print_r($res['backups']);
// Error
}else{
echo 'Some error occured';
print_r($res['error']);
}
Backup an Installed Script
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| backup
| The value should be "backup" to perform the action of taking the backup of the installation.
|
insid
| 26_5454 (Installation ID)
| Installation ID of the installed script. It can be fetched from List Installed Script |
POST
|
---|
backupins
| 1
| This will trigger the backup function.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=backup'.
'&insid=26_4545';
$post = array('backupins' => 1);
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
Restore an Installed Script
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| restore
| The value should be "restore" to perform the action of restoring the backup of the installation.
|
restore
| backup_time_insid.zip (Backup File Name)
| Name of the Backup File. It can be fetched from List Backups |
POST
|
---|
restore_ins
| 1
| This will trigger the restore function.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=restore'.
'&restore=backup_time_insid.zip';
$post = array('restore_ins' => 1);
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
Download Backups
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| backups
| The value should be "backups" to perform the action of downloading the backup of an installation.
|
download
| backup_time_insid.zip (Backup File Name)
| Name of the Backup File. It can be fetched from List Backups |
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=backups'.
'&download=backup_time_insid.zip';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// This will have the backup file content
print_r($resp);
Delete Backups
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| backups
| The value should be "backups" to perform the action of downloading the backup of an installation.
|
remove
| backup_time_insid.zip (Backup File Name)
| Name of the Backup File. It can be fetched from List Backups |
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=backups'.
'&remove=backup_time_insid.zip';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
Edit Enduser Settings
Key
| Value
| Description
|
---|
Authenitcation
| -
| You can use the Enduser Authenticating method. |
act
| settings
| The value should be "settings" to perform the action of updating the settings of a user.
|
POST
|
---|
editsettings
| 1
| This will trigger the edit settings function
|
language
| english
| The language you want to set for the user.
|
timezone
| 0
| This is the timezone that you want to set for the user. User 0 to set the timezone to Server Default.
|
Example
// The URL
$url = 'https://user:password@domain.com:2003/index.php?'.
'&api=serialize'.
'&act=settings';
$post = array('editsettings' => 1,
'language' => 'english',
'timezone' => '0');
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);