Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Create Ticket Api Error

Hello experts, i have one problem. I want to open ticket and working local.


$config = array(

$data = array(
'name'      =>      'John Doe',
'email'     =>      '',
'subject'   =>      'Test API message',
'message'   =>      'This is a test of the osTicket API',
'ip'        =>      $_SERVER['REMOTE_ADDR'],
'attachments' => array(),

function_exists('curl_version') or die('CURL support required');
function_exists('json_encode') or die('JSON support required');
#set timeout
#curl post
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['url']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.9');
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config['key']));
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($code != 201)
die('Unable to create ticket: '.$result);
$ticket_id = (int) $result;


I'm getting Unable to create ticket error. Where is the problem ?  Where i am doing wrong ? any idea ? Thanks.


  • I would recommend that you check your PHP error logs.  Because with out an actual error no one here will be of much assistance.
  • I'm using xampp in local and when I was looking at the apache error logs, I've encountered something like that: "POST /upload/tickets.json HTTP/1.1" 404 1057 "-" "osTicket API Client v1.9". By the way, I've tried same processes in web deploying and it works without error.

  • Then I would say that your issue is with XAMPP.
  • edited February 2017
    thanks for be interested
Sign In or Register to comment.