# API: Get client tickets
# getClientTickets
Get list of client's support tickets.
TIP
This API call uses pagination for results.
# Required parameters
Parameter | Description |
---|---|
id | Client ID |
# Optional parameters
Parameter | Description |
---|---|
page | Which page to return |
sort | Sort the ticket by time [ASC |
filter[status] | Filter by ticket status values: [Open |
filter[request_type] | Filter by ticket request type values: [General |
filter[name] | Filter by submitter name |
filter[dept_id] | Filter by department id |
filter[ticket_number] | Filter by ticket number |
filter[body] | Filter by message |
filter[email] | Filter by email |
filter[tag] | Filter by tag |
filter[owner_id] | Filter by owner id |
filterop[date] | Filter by ticket date, possible values: = , < , > , != |
filter[date] | Filter by ticket date, format: YYYY-MM-DD |
filter[admin_read] | Filter by admin read status checkbox values: [0 |
# Request
GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=getClientTickets&id=ID
# PHP Samples
$url = 'http://url_to_hb.com/admin/api.php';
$post = [
'call' => 'getClientTickets',
'api_id' => $API_ID,
'api_key' => $API_KEY,
'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, 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 = [
'id' => $ID,
];
$return = HBWrapper::singleton()->getClientTickets($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [
'id' => $ID,
];
$return = $api->getClientTickets($params);
print_r($return);
# Response
{
"success": true,
"tickets": [
{
"admin_read": "1",
"id": "17",
"type": "Admin",
"firstname": "Test",
"lastname": "Customer",
"date": "2011-10-04 09:14:31",
"lastreply": "13 minutes ago",
"dept_id": "1",
"name": "Test Customer",
"client_id": "1",
"status": "In-Progress",
"ticket_number": "814003",
"tsubject": "#814003 - Test support message",
"deptname": "Support",
"priority": "0",
"notes": ""
}
],
"totalpages": 1,
"call": "getClientTickets",
"server_time": 1317713317
}