After Hours of tryin to get the API to work, im DONE!! :D
I did take some Screenshots in order to explain my Problem better.
Did install the newest Version of osTicket. Did create an API-Key and did download the Sample.php. In there i did replace the Data.
In that Case im gonna get the Error Message: "Unable to create Ticket: " (space after ":" is nothing, cause the Variable $result isnt showin for some reason...)
In the Admin-Panel in osTicket i did change some Contents bout the Forms and Form-Settings. Dont think it has to do with that, isnt? (Pls loook at the Screenshot for further Info)
I did, like in the Instructions and in my Screenshot, change the Variables to match with these in my ticket_create.php File.
Not havin any kind of problem to show my API-Key. Its just a Demo-Site, so its wayne..at the other Point you can have a better look into my situation.
Here i did copy the Code of my ticket_create.php - File which remains meanwhile in the root-Folder of my Webspace. The API Folder is in the /lsticket/api.
Strange is that im not havin any File named tickets.json or somethin like that. Im havin just cron.php, http.php, ecron.php etc..
# Configuration: Enter the url and key. That is it.
# url => URL to api/task/cron e.g # http://yourdomain.com/support/api/tickets.json
# key => API's Key (see admin panel on how to generate a key)
$config = array(
# Fill in the data for the new ticket, this will likely come from $_POST.
$data = array(
'name' => 'John Doe',
'email' => 'email@example.com',
'subject' => 'Test API message',
'message' => 'This is a test of the osTicket API',
'ip' => $_SERVER['REMOTE_ADDR'],
'attachments' => array(),
* Add in attachments here if necessary
function_exists('curl_version') or die('CURL support required');
function_exists('json_encode') or die('JSON support required');#set
$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.8');
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config['key']));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($code != 201)
die('Unable to create ticket: '.$result);
$ticket_id = (int) $result;
# Continue onward here if necessary. $ticket_id has the ID number of the
# newly-created ticket
Times in Future, the Array will be filled with $_POST Data containing some Stuff from other Forms! But this can only happen if this damn API will work.
If someone notice the Field IP-Adress in the Screenshot (osTicket german Version), did change it with the Help of phpmyadmin. We are usin a subdomain host (see Screenshot), and we cant get a right ip for it, so were usin the subdomain instead. Maybe this is the Problem, but how to resolve?
If someone is rly skilled what hes doin, i can give him the Admin-Account so he can find a way to repair this..
Im hopin you Guys get a solution! Im sittin hours and hours right bfore this Stuff and cant get it workin...