Get ticket

Check a specific ticket


Endpoint


Method URI
POST https://apiv2.keliweb.it/api/v2/keliweb/get-ticket

Request Parameters


Parameter Type Description Required
HTTP headers: Authorization string Bearer + the token to access APIs Required
ticketnum string Obtain the ticket for the specific Client Ticket Number Optional
ticketid integer Obtain the ticket for the specific ticket id (Either $ticketnum or $ticketid is required) Optional
repliessort string ASC or DESC. Which order to organise the ticket replies Optional

Response Parameters


Parameter Type Description
result string The result of the operation: success or error
ticketid integer The unique Id of the ticket
ticketnum string The unique ticket number string displayed to end users
c string The client unique access of the ticket
deptid integer The id of the department the ticket belongs to
deptname string The name of the department the ticket belongs to
userid integer The user id the ticket belongs to
contactid integer The contact id the ticket was opened by
name string The name of the user
email string The email address of the user
cc string The cc email addresses for the ticket
date date The date the ticket was opened Y-m-d H:i:s
subject string The subject of the ticket
status string The status of the ticket
priority string The priority of the ticket
admin string The name of the admin user who opened the ticket
lastreply date The date the ticket was last replied to Y-m-d H:i:s
flag integer The id of the admin user a ticket is flagged to
service string The id of the service associated with the ticket. Sx for services. Dx for domains
replies array an Array of replies on the ticket
notes array an Array of notes on the ticket

Example Request (PHP Curl)

            

                    $curl = curl_init();
                    
                    curl_setopt_array($curl, array(
                      CURLOPT_URL => "https://apiv2.keliweb.it/api/v2/keliweb/get-ticket",
                      CURLOPT_RETURNTRANSFER => true,
                      CURLOPT_ENCODING => "",
                      CURLOPT_MAXREDIRS => 10,
                      CURLOPT_TIMEOUT => 0,
                      CURLOPT_FOLLOWLOCATION => false,
                      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                      CURLOPT_CUSTOMREQUEST => "POST",
                      CURLOPT_POSTFIELDS =>
                        http_build_query(
                                array(
                                    'ticketid' => '1'
                                )
                            ),
                      CURLOPT_HTTPHEADER => array(
                        "Content-Type: multipart/form-data",
                        "X-Requested-With: XMLHttpRequest",
                        "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NhMmNlNkNjNhMmU2MmUxIzZDRkODY5MS1mMDMzLTQ1MWMtYjU-3EHc",
                      ),
                    ));
                    
                    $response = curl_exec($curl);
                    $err = curl_error($curl);
                    
                    curl_close($curl);
                    
                    if ($err) {
                      echo "cURL Error #:" . $err;
                    } else {
                      echo $response;
                    }

            
        

Example Request (jQuery AJAX)

            
                    var form = new FormData();
                    form.append("ticketid", "1");

                    var settings = {
                        "async": true,
                        "crossDomain": true,
                        "url": "https://apiv2.keliweb.it/api/v2/keliweb/get-ticket",
                        "method": "POST",
                        "headers": {
                            "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImNjMDEwYWVlYmUzMjMxMmZlZjBiNzRjYTBhMmNlNDc2MjNjNhMMTA1MzJjODk1In0",
                            "cache-control": "no-cache",
                        },
                        "processData": false,
                        "contentType": false,
                        "mimeType": "multipart/form-data",
                        "data": form
                    }

                    $.ajax(settings).done(function (response) {
                        console.log(response);
                    });
            
        

Example Response (JSON payload)

            
                {
                    "result": "success",
                    "ticketid": "1",
                    "tid": "516757",
                    "c": "KPqH7yG3",
                    "deptid": "1",
                    "deptname": "Sample Support Department",
                    "userid": "1",
                    "contactid": "0",
                    "name": "Cynthia Reilly",
                    "email": "testuser@whmcs.com",
                    "cc": "",
                    "date": "2016-01-01 06:26:29",
                    "subject": "This is a sample ticket",
                    "status": "Closed",
                    "priority": "Medium",
                    "admin": "",
                    "lastreply": "2016-01-01 06:30:16",
                    "flag": "0",
                    "service": "",
                    "replies": {
                        "reply": [
                            {
                                "replyid": "0",
                                "userid": "1",
                                "contactid": "0",
                                "name": "Cynthia Reilly",
                                "email": "testuser@whmcs.com",
                                "date": "2016-01-01 06:26:29",
                                "message": "Hey, \r\n\r\nThis is the first ticket message!\r\n\r\nThanks\r\n\r\nCynthia",
                                "attachment": "",
                                "admin": ""
                            },
                            {
                                "replyid": "1",
                                "userid": "1",
                                "contactid": "0",
                                "name": "",
                                "email": "",
                                "date": "2016-01-01 06:27:01",
                                "message": "Hello, \r\n\r\nThis is the first ticket reply by an admin user!\r\n\r\nThanks\r\n\r\nDemo Admin",
                                "attachment": "",
                                "admin": "Demo Admin",
                                "rating": "0"
                            },
                            {
                                "replyid": "2",
                                "userid": "1",
                                "contactid": "0",
                                "name": "",
                                "email": "",
                                "date": "2016-01-01 06:30:16",
                                "message": "Hey, \r\n\r\nThis is a second reply!\r\n\r\nThanks\r\n\r\nCynthia",
                                "attachment": "",
                                "admin": "",
                                "rating": "0"
                            }
                        ]
                    },
                    "notes": {
                        "note": [
                            {
                                "noteid": "1",
                                "date": "2016-01-01 06:26:42",
                                "message": "This is a ticket note",
                                "admin": "Demo Admin"
                            }
                        ]
                    }
                }