buy
Enduser Authentication

Description

There are 2 ways to authenticate while making API calls to Webuzo :
1) Using API Key (These can be generated from Webuzo Enduser Panel -> Configuration -> API Keys page)
2) Using username and password

We will take a simple List Domains API call in the example below.

API Credentials

Perform Enduser Panel tasks with your API credentials. API Key can be generated from Webuzo Enduser Panel -> Configuration -> API Keys page

curl --insecure -d "apiuser=username" -d "apikey=50bjj06Ko77pJ3QvFR9BY1JpLYglezRO" -X POST "https://hostname:2003/index.php?api=json&act=domainmanage"
<?php

$apiuser = 'username';
$apikey = '50bjj06Ko77pJ3QvFR9BY1JpLYglezRO';
 
$post = array('apiuser' => $apiuser, 
              'apikey' => $apikey
);

$url = 'https://hostname.com:2003/index.php?api=json&act=domainmanage'; 

// 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, 5); 
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. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['domains_list'])){
    echo "<pre>";
    print_r($res['domains_list']);
    echo "</pre>";
}else{
    print_r($res['error']);
}

Login Credentials

Perform Enduser Panel tasks with your login credentials.

curl --insecure -u  "username:password" -X POST "https://hostname:2003/index.php?api=json&act=domainmanage"
<?php
$user = 'username';
$pass = 'password';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@domain.com:2003/index.php?api=json&act=domainmanage'; 

// 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, 5); 
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. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['domains_list'])){
    echo "<pre>";
    print_r($res['domains_list']);
    echo "</pre>";
}else{
    print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');
$user = 'username';
$pass = 'password';
$host = 'hostname';

$webuzo = new Webuzo_SDK($user, $pass, $host);

$res = $webuzo->list_domains();

// Done/Error
if(!empty($res['domains_list'])){
	print_r($res['domains_list']);
}else{
	print_r($res['error']);
}

?>

Admin Login As Enduser

You can Perform any tasks in the Enduser Panel with your Admin/Reseller API Key or Login Credentials using the "loginAs" parameter. Lets try to list domains of the user "soft".

curl --insecure -d "apiuser=root" -d "apikey=50bjj06Ko77pJ3QvFR9BY1JpLYglezRO" -X POST "https://hostname:2003/index.php?api=json&act=domainmanage&loginAs=soft"
<?php

$apiuser = 'root';
$apikey = '50bjj06Ko77pJ3QvFR9BY1JpLYglezRO';
 
$post = array('apiuser' => $apiuser, 
              'apikey' => $apikey
);

$url = 'https://hostname.com:2003/index.php?api=json&act=domainmanage&loginAs=soft'; 

// 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, 5); 
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. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['domains_list'])){
    echo "<pre>";
    print_r($res['domains_list']);
    echo "</pre>";
}else{
    print_r($res['error']);
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list