Webuzo Enduser API
Overview
Webuzo Enduser API can be used to perform various functions in Webuzo like add domains, delete domains.
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_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
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.
Add Domains
Example
$url = 'https://user:password@domain.com:2003/index.php?'.'&api=serialize'.'&act=domainadd';
$post = array('add' => '1',
'domain_type' => 'subdomain',
'domain' => 'domain.com',
'wildcard' => 0,
'issue_lecert' => 1,
'domainpath' => 'public_html/subdomain',
'subdomain' => 'subdomain',
);
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
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']);
}