# API: Search
# search
Search hostbill database for clients, services, domains and tickets.
# Required parameters
Parameter | Description |
---|---|
query | Search Query |
# Request
GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=search&query=QUERY
# PHP Samples
$url = 'http://url_to_hb.com/admin/api.php';
$post = [
'call' => 'search',
'api_id' => $API_ID,
'api_key' => $API_KEY,
'query' => $QUERY,
];
$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, http_build_query($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);
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = [
'query' => $QUERY,
];
$return = HBWrapper::singleton()->search($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [
'query' => $QUERY,
];
$return = $api->search($params);
print_r($return);
# Response
{
"success": true,
"results": {
"Clients": [
{
"id": "27",
"firstname": "John",
"lastname": "Doe",
"email": "hostbill@hostbillapp.com",
"companyname": "",
"ip": "192.168.56.1"
}
],
"Domains": [],
"Accounts": [
{
"id": "91",
"firstname": "John",
"lastname": "Doe",
"username": "hb_client_27_5",
"domain": "testhostbill"
}
],
"Tickets": [
{
"ticket_number": "208032",
"subject": "test",
"id": "2",
"name": "John Doe",
"email": "hb.test@hostbillapp.com"
}
],
"Invoices": false,
"Estimates": [],
"Transactions": [],
"Orders": [
{
"id": "105",
"number": "1650966735",
"firstname": "John",
"lastname": "Doe",
"date_created": "2016-02-24 04:53:59",
"status": "Pending"
}
],
"RecurringInvoices": false
},
"call": "search",
"server_time": 1460986923
}