HelpDeskZ Community
API - Create a new tickets - Printable Version

+- HelpDeskZ Community (http://community.helpdeskz.com)
+-- Forum: HelpDeskZ 2 (http://community.helpdeskz.com/forum-3.html)
+--- Forum: Support (http://community.helpdeskz.com/forum-5.html)
+--- Thread: API - Create a new tickets (/thread-89.html)



API - Create a new tickets - guilherme - 06-10-2021

Hi, I'm trying to create a ticket through the API and I just got:
{"error":1,"message":"Ticket not found."}
Below is the php:
<?php
$token = "xxxx";
$request = ['opener' => 'user', 'user_id' => 3, 'staff_id' => 1, 'department_id' => 4, 'subject' => 'test', 'body' => 'This is a test.', 'attachment[]'=> new CURLFILE(''), 'notify' => 1];
$authorization = 'Token: '.$token;
$curl = curl_init('https://xxxxxxx.com.br/support/api/tickets/create');
curl_setopt($curl, CURLOPT_HTTPHEADER, array($authorization));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, POST);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($curl);
echo $response;
curl_close($curl);
What am I doing wrong?