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
Key | Value | Description |
---|---|---|
Authenitcation | - | You can use the Enduser Authenticating method. |
act | domainadd | The value should be "domainadd" for webuzo to perform the action of an adding a domain. |
POST | ||
domain_type | parked, addon, subdomain | You have to add any of them one type but by default it's type is "parked". |
domain | domain.com | This is the domain which you wish to add. |
wildcard | 1 | if value equal to "1" then it will allow "*.domain.com" i.e all subdomains to the domain folder. |
issue_lecert | 1 | if value equal to "1" then it will issue SSL certificate from Let's Encrypt for the new domain. |
domainpath | public_html/ | if your domain type value is "addon" or ''subdomain" then domain path should be "public_html/domain" or "public_html/subdomain" and this will create a directory by domain/subdomain name. |
subdomain | subdomain | This subdomain added to the beginning of your domain name. |
add | 1 | This will trigger the add. |
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']);
}