Hello guys,             I am able to create ticket but its only create ticket but i want to assigne ticket to member.I am using following script and adding assign to field but its not working.#!/usr/bin/php -q?php# 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( 'url'=>'http://domain.org/support/upload/api/http.php/tickets.json', 'key'=>'148DCB0jfjB794788CB1902E8DF906482' );# Fill in the data for the new ticket, this will likely come from $_POST.$data = array( 'name' => 'Nilesh Raut', 'email' => 'nilesh_raut@yahoo.com', 'subject' => 'Yahoo Test mail', 'assign to' => 'emaiId', // here i want to assign ticket. 'message' => 'Please provide credentials', 'ip' => $_SERVER, 'attachments' => array(),);/* * Add in attachments here if necessary$data =array('filename.pdf' => 'data/png;base64,' . base64_encode(file_get_contents('/path/to/filename.pdf'))); */#pre-checksfunction_exists('curl_version') or die('CURL support required');function_exists('json_encode') or die('JSON support required');#set timeoutset_time_limit(30);#curl post$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $config);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.7');curl_setopt($ch, CURLOPT_HEADER, FALSE);curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config));curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);$result=curl_exec($ch);$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);curl_close($ch);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?> How to assigne ticket using Json.

I do not believe that there is a way to assign tickets via the API at this time.

Hey ntozier please can you provide list of all api's are provided by osticket.

Hi Nilesh,Can you post the code of api/tickets.json?I have that file but it is empty.

@uzairjamal you can get the files from github.@Nilesh the API is really basic right now, and pretty much just allows for opening tickets to my knowledge.

4 months later

I was able to get tickets auto assigned to individual staff members but not teams (yet).  I used a sample file by Andrew Bennett (link) and appended the following $data = array("alert" => "true",       "autorespond" => "true",       "source" => "API",       "name" => "Angry User",       "email" => "api@osticket.com",       "subject" => "Testing API 3",       "message" => "MESSAGE HERE",       "assignId" => '1' // THIS IS THE STAFF ID FROM THE DATABASE 'OST_STAFF.STAFF_ID');

a year later

I cannot get assignid to work on my osTicket v1.10-RC.2, They create a new ticket but the ticket is not assign to a staff person.Is they a api for setting department ?

Q: Is they a api for setting department ?A: It doesn't look like it.https://github.com/osTicket/osTicket-1.8/blob/b1c845bf0591b1f5da593a55e462b07e5a4ee5de/setup/doc/api/tickets.md

4 years later

Just a quick note that on version 1.4 I've used the field staffId (capital 'I') to get the ticket automatically assigned.

There may be other points to note - but this seems to be OK for now.

Write a Reply...