API:getClientOrders - Get client orders
Get list of client's orders.
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=getClientOrders&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()->getClientOrders($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' => 'getClientOrders',
'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->getClientOrders($params);
print_r($return);
?>
Response
{
"success": true,
"orders": [
{
"id": "71",
"date_created": "2011-12-09 03:26:29",
"number": "2070437339",
"total": "178.00",
"status": "Active",
"firstname": "Jack",
"lastname": "Black",
"module": "AlertPay",
"client_id": "8",
"invtotal": "178.00",
"invstatus": "Paid",
"currency_id": "0",
"balance": "Completed"
},
{
"id": "70",
"date_created": "2011-12-07 00:31:31",
"number": "104792403",
"total": "295.00",
"status": "Pending",
"firstname": "Jack",
"lastname": "Black",
"module": "AlertPay",
"client_id": "8",
"invtotal": "295.00",
"invstatus": "Unpaid",
"currency_id": "0",
"balance": "Incomplete"
}
],
"call": "getClientOrders",
"server_time": 1323444240
}