Add ticket reply
Add a reply to a ticket by Ticket ID
Endpoint
Method | URI |
---|---|
POST |
https://apiv2.keliweb.it/api/v2/keliweb/add-ticket-reply
|
Request Parameters
Parameter | Type | Description | Required |
---|---|---|---|
HTTP headers:
Authorization
|
string |
Bearer + the token to access APIs
|
Required |
ticketid
|
integer | The id of the ticket in the database. Either $ticketnum or $ticketid is required | Required |
message
|
string | The content of the ticket reply | Required |
markdown
|
boolean | Should markdown be used on the ticket reply output | Optional |
contactid
|
integer | Pass a contactid to associate the ticket reply with a specific contact belonging to $clientid | Optional |
name
|
string | The name to associate with the ticket reply if not an admin or client response | Optional |
email
|
string | The email to associate with the ticket reply if not an admin or client response | Optional |
customfields
|
string | A base64 encoded array of the custom fields to update | Optional |
attachments
|
array | Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below). | Optional |
Response Parameters
Parameter | Type | Description |
---|---|---|
result
|
string | The result of the operation: success or error |
Example Request (PHP Curl)
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apiv2.keliweb.it/api/v2/keliweb/add-ticket-reply",
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',
'message' => 'This is a sample ticket reply',
'clientid' => '1',
'customfields' => base64_encode(serialize(array("1"=>"Google"))),
'useMarkdown' => true,
'attachments' => base64_encode(json_encode([['name' => 'sample_text_file.txt', 'data' => base64_encode('This is a sample text file contents')]])),
)
),
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");
form.append("message", "This is a sample ticket reply");
form.append("clientid", "1");
form.append("customfields", "[]");
form.append("useMarkdown", true);
form.append("attachments", "[]");
var settings = {
"async": true,
"crossDomain": true,
"url": "https://apiv2.keliweb.it/api/v2/keliweb/add-ticket-reply",
"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"
}