API - create Ticket with attachment

  • Used Zammad version: 3.4
  • Used Zammad installation source: (source, package, …)
  • Operating system: Ubuntu
  • Browser + version: Chrome

Expected behavior:

Create an Api Ticket with an attachment (PDF/JPG/png).

  • Open PDF in Browser
  • Open JPG in Browser

Actual behavior:

We create an Api Ticket with an attachment (PDF/JPG).
After we create the ticket, its not Possible to have a privew of the Image. Its only possible to download the file. In front of the File we see an Question mark.

Steps to reproduce the behavior:

(We use the zammad php Api from github)
Code:
$ticket_data = [
‘group_id’ => 14, # Queue "Kundenformular
‘priority_id’ => 2, # Prioriät Normal
‘state_id’ => 1, # Status Neu
‘title’ => $ticket_title,
‘customer_id’ => $user_id, # Kunde
‘projekt_nummer’ => $projekt_nummer,
‘article’ => [
‘content_type’ => ‘text/html’,
‘subject’ => $ticket_title,
‘body’ => $ticket_text,
‘attachments’ => [
[
‘filename’ => ‘favicon.png’,
‘data’ => getFileContentBase64(‘favicon.png’),
‘mime-type’ => ‘image/png’,
],
[
‘filename’ => ‘TMR-Internet-Zusammenfassung.pdf’,
‘data’ => getFileContentBase64(‘TMR-Internet-Zusammenfassung.pdf’),
‘mime-type’ => ‘application/pdf’,
],
],
],
];
$ticket = $client->resource(ResourceType::TICKET);
$ticket->setValues($ticket_data);
$ticket->save();