Create Ticket Message
Function
As of version 5.2.5.0
POST /api/v2/api.php p_ticketmessage_create=1
|
Filters
Name |
POST Key |
Type |
Required |
Comment |
Example |
SendEmailResponder | p_sendemailresponder | bool | No | Send autoresponder email to sender of message | 1 | SendEmailReply | p_sendemailreply | bool | No | Send operator reply email to receiver of message | 1 | QuoteMessageId | p_quotemessageid | string | No | The Ticket Message ID of the Message the Operator is replying to. | 90f9cf... |
|
CURL Example
curl {yourdomain}{livezilla_folder}/api/v2/api.php -d {authenthication} -d p_ticketmessage_create=1 -d p_data={
"TicketMessage": {
"Type": "0",
"Customs": "",
"ChannelId": "",
"Subject": "Can you help?",
"Comments": "",
"TicketId": "11701",
"Text": "Hello, please help me.",
"Fullname": "Johanna Doe",
"Company": "Jdscompany Ltd.",
"Phone": "004988373728",
"Email": "johanna@jdscompany.com",
"IP": "192.168.1.222",
"SenderId": "john_doe"
}
} -X POST
|
Response
200 Ok: {
"TicketMessage": {
"Type": "0",
"Customs": "",
"CallMeBack": "true",
"ChannelId": "",
"Attachments": "",
"Edited": "1395332206",
"Subject": "Can you help?",
"Comments": "",
"TicketId": "11701",
"Text": "Hello, please help me.",
"Created": "1395332206",
"Id": " First Message: 11701 Second Message: 246733d03f64db3b72af327d0d835ebd",
"Fullname": "Johanna Doe",
"Company": "Jdscompany Ltd.",
"Phone": "004988373728",
"Email": "johanna@jdscompany.com",
"IP": "192.168.1.222",
"SenderId": "john_doe"
}
}
|
Error Codes
403 Forbidden: Invalid or no user authentication data sent (see General API Authentication)
400 Bad Data: Invalid or missing POST parameters (see required fields/filters and data types)
|
Example: PHP code to add a message to an existing ticket
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_ticketmessage_create"]=1;
$postd["p_json_pretty"]=1;
class TicketMessage
{
public $Fullname = "Johanna Doe";
public $TicketId = 11704;
public $Email = "johanna@jdscompany.com";
public $Phone = "004988373728";
public $Type = 0;
public $Text = "Hello, please help me.";
public $Subject = "http://www.mywebsite.domain/products";
public $IP = "217.2.5.1";
public $Company = "Jdscompany Ltd.";
//public $Customs = array(array("CustomerNumber","11112726"));
//public $Comments = array(array("john_doe","comment #1"),array("john_doe","comment #2"));
}
$newMessage = new TicketMessage();
$postd["p_data"]= json_encode(array("TicketMessage"=>$newMessage));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
curl_close($ch);
?>