API:getClientAccounts - Get client accounts
Get list of client's accounts.
Required parameters
- id
- Client ID
Optional parameters
- page
- Which page to return
Request
GET http://url_to_your_hostbill.com/admin/api.php?api_id=API_ID&api_key=API_KEY&call=getClientAccounts&id=ID
<?php
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = array(
'id'=>ID
);
$return = HBWrapper::singleton()->getClientAccounts($params);
print_r($return);
?>
<?php
$url = 'http://url_to_hb.com/admin/api.php';
$post = array(
'api_id' => API_ID,
'api_key' => API_Key,
'call' => 'getClientAccounts',
'id'=>ID
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);
$return = json_decode($data, true);
print_r($return);
?>
<?php
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = array(
'id'=>ID
);
$return = $api->getClientAccounts($params);
print_r($return);
?>
Response
{
"success": true,
"accounts": [
{
"id": "42",
"manual": "0",
"domain": "billing.com",
"billingcycle": "Monthly",
"status": "Active",
"total": "8.95",
"next_due": "2011-12-22",
"name": "Business Hosting",
"type": "1",
"lastname": "Blue",
"firstname": "Mike",
"client_id": "6",
"currency_id": "0"
},
{
"id": "41",
"manual": "0",
"domain": "helpdesk.com",
"billingcycle": "Monthly",
"status": "Active",
"total": "4.95",
"next_due": "2011-12-22",
"name": "Starter Hosting",
"type": "1",
"lastname": "Blue",
"firstname": "Mike",
"client_id": "6",
"currency_id": "0"
}
],
"call": "getClientAccounts",
"server_time": 1323444481
}