# API: Get ticket
# getTicketDetails
View ticket details by its number.
# Required parameters
Parameter | Description |
---|---|
id | Ticket number |
# Request
GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=getTicketDetails&id=ID
# PHP Samples
$url = 'http://url_to_hb.com/admin/api.php';
$post = [
'call' => 'getTicketDetails',
'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()->getTicketDetails($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [
'id' => $ID,
];
$return = $api->getTicketDetails($params);
print_r($return);
# Response
{
"success": true,
"ticket": {
"id": "17",
"date": "2011-10-04 09:14:31",
"lastreply": "2011-10-04 09:14:48",
"ticket_number": "814003",
"acc_hash": "szpmn0",
"dept_id": "1",
"client_id": "1",
"name": "Default User",
"email": "john@doe.com",
"cc": "",
"subject": "Test support message",
"body": "Testing 123",
"status": "In-Progress",
"priority": "0",
"admin_read": "1",
"client_read": "0",
"type": "Admin",
"deptname": "Support",
"viewtime": "2011-10-04 09:15:36"
},
"replies": [
{
"id": "23",
"ticket_id": "17",
"replier_id": "1",
"name": "Default User",
"email": "testmail@hostbillappx.com",
"date": "2011-10-04 09:14:48",
"body": "Hello is popular reply....\r\n\r\n\r\n--my signature--",
"status": "Sent",
"type": "Admin"
}
],
"attachments": [],
"notes": [
{
"id": "1",
"ticket_id": "17",
"admin_id": "0",
"name": "Name",
"email": "",
"date": "2011-10-05 23:44:01",
"note": "Test note"
},
{
"id": "2",
"ticket_id": "17",
"admin_id": "0",
"name": "Name",
"email": "",
"date": "2011-10-05 23:46:05",
"note": "Test note 2"
}
],
"call": "getTicketDetails",
"server_time": 1317712536
}