Jump to content


Unable to add attachments to ticket using API


2 replies to this topic

#1 itsecureadmin

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 March 2015 - 11:43 PM

I have created a PHP form to submit a ticket to LiveZilla using the API and am trying to get attachments to work. The tickets are created just fine, ticketMessage is also added without issue, as well as the operator assignment.

I'm using the latest LiveZilla version.

I'm using the following PHP code:

...
extract($_POST, EXTR_PREFIX_ALL, "livezilla");
...

class TicketMessage
{
public $Fullname = "Test Name";
public $TicketId = 117117;
public $Email = "john@doe.com";
public $Company = "JDSCompany";
public $Phone = "555-555-5555";
public $Type = 0;
public $Subject = "http://example.com/";
public $Text = "John's Question";
public $SenderId = "support-operator";
public $IP = "127.0.0.1";
public $Attachments = array();
public $Customs = array(array("Department","Tech Support"));
}

$newMessage = new TicketMessage();
$newMessage->Fullname = $livezilla_name;
$newMessage->TicketId = $ticket_id;
$newMessage->Email = $livezilla_email;
$newMessage->Company = $livezilla_company;
$newMessage->Phone = $livezilla_phone;
$newMessage->Text = $livezilla_question;
$newMessage->IP = get_client_ip();
$newMessage->Attachments = $_FILES['attachments']['name'];
$newMessage->Customs = array(array("Department",$livezilla_department));

var_dump($newMessage);
echo "<br />";
echo "<br />";
var_dump($_FILES);

...


The ticket is created just fine, without the attachment (or custom field department), and the output of the two var_dump statements and the server output from the ticketMessage is:

object(TicketMessage)#4 (12) { ["Fullname"]=> string(8) "John Doe" ["TicketId"]=> int(11749) ["Email"]=> string(12) "john@doe.com" ["Company"]=> string(21) "Form ticket submittal" ["Phone"]=> string(12) "555-555-5555" ["Type"]=> int(0) ["Subject"]=> string(35) "http://example.com/" ["Text"]=> string(36) "Troubleshooting attachment failures." ["SenderId"]=> string(7) "support" ["IP"]=> string(14) "70.x.x.x" ["Attachments"]=> string(14) "icon-small.png" ["Customs"]=> array(1) { [0]=> array(2) { [0]=> string(10) "Department" [1]=> string(17) "Tech Support" } } }

array(1) { ["attachments"]=> array(5) { ["name"]=> string(14) "icon-small.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpz8qxSK" ["error"]=> int(0) ["size"]=> int(1011) } }


{"TicketMessage":{"Type":0,"Customs":[],"CallMeBack":false,"ChannelId":"24f919526941d389baff3a400863ba5e","Attachments":[],"Subject":"http:\/\/example.com\/","Comments":[],"TicketId":11750,"Text":"Troubleshooting attachment failures.","Id":11750,"Fullname":"John Doe","Company":"Form ticket submittal","Phone":"555-555-5555","Email":"john@doe.com","IP":"70.x.x.x","SenderId":"support"}}

When I view the ticket using the web operator client or the windows client, the ticket has no attachments. I don't see any output in _log or any errors in the apache log.

How can I attach the file to the ticket using the API?

Thanks,
Josh

#2 Patrick Keil

    Administrator

  • Administrators
  • 3816 posts
  • LocationSingen, Germany

Posted 25 March 2015 - 06:54 AM

Quote

How can I attach the file to the ticket using the API?
Unfortunately, you can't. Attachments are currently unsupported in API 2.0.

#3 itsecureadmin

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 25 March 2015 - 05:03 PM

Thanks for the response, Patrick.

Are there plans to support this feature in the future?

Thanks,
Josh





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users