buy
API Keys

Description

Use the API Keys API's to Add and Delete API Keys.

Add API Key

Parameters

Sample Code

curl --insecure -d "ip[]=ip1" -d "ip[]=ip2" -X POST  "https://hostname:2003/index.php?api=json&act=apikey&do=1&notes=notes&apiuser=username&apikey=pass_api_key"
<?php
 
$url = 'https://hostname:2003/index.php?api=json&act=apikey&apiuser=user_name&apikey=pass_api_key'; 

$post = array('do' => 1, 
	      'ip' => ['ip1', 'ip2'],
	      'notes' => 'notes'
);


// 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['done'])){
    echo "<pre>";
    print_r($res['done']['msg']);
    echo "</pre>";
}else{
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'user_name';
$pass = 'password';
$host = 'hostname';

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

$ip = ['ip1','ip2'];
$notes = 'notes';

$res = $webuzo->api_keys($ip, $notes);

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

?>

Output

The key has been created successfully.

Delete API Key

Parameters

Sample Code

curl --insecure "https://hostname:2003/index.php?api=json&act=apikey&del=pass_api_key_for_delete&apiuser=user_name&apikey=pass_api_key"
<?php
 
$url = 'https://hostname:2003/index.php?api=json&act=apikey&apiuser=user_name&apikey=pass_api_key'; 

$post = array('del' => 'pass_api_key_for_delete'
);


// 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['done'])){
    echo "<pre>";
    print_r($res['done']['msg']);
    echo "</pre>";
}else{
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'user_name';
$pass = 'password';
$host = 'hostname';

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

$api_key = 'pass_api_key_for_delete';

$res = $webuzo->delete_api_keys($api_key);

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

?>

Output

The key has been deleted successfully

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list