I need to be able to pass user information as an internal note in an API created ticket. So far I have the following code which will send a ticket but will not pass the internal note or the phone number...$config = array(

'url'=> 'https://xxxx.com/support/api/http.php/tickets.json',

'key'=> 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

);

$name = 'TEST API USER';

$email = 'test@test.com';

$mobile = '5555555555';

$subject = 'just testing';

$text = 'test message';

$notes = 'this is an internal note';

$data = array(

'name' => $name,

'email' => $email,

'subject' => $subject,

'message' => $text,

'notes' => $notes,

'phone' => $mobile,

'ip' => $_SERVER,

);

set_time_limit(30);

$options = array(

'http' => array(

'header' => "X_API_Key: ".$config,

'method' => 'POST',

'content' => json_encode($data)

)

);

$context = stream_context_create($options);

$result = file_get_contents($config, false, $context);

if ($result === FALSE) { die("FAILED"); }

echo($result);The API documentation found here mentions internal notes and phone numbers as custom fields. I have read several requests for this functionality in this forum...http://forum.osticket.com/d/discussion//show-internal-notes-inline-with-ticket-threadhttp://forum.osticket.com/d/discussion//add-notes-to-ticket-via-apihttp://forum.osticket.com/d/discussion//internal-comment-with-apiThis ability is essential for us and I'm sure others. Is there any way to achieve this?

13 days later

API documentation:https://github.com/osTicket/osTicket/blob/55dc25ace736baeaf224ee608cfabc0218022036/setup/doc/api/tickets.mdGiven the following data array:$data = array(    'name'      =>      'Jack Doe',  // from name aka User/Client Name    'email'     =>      'jumpinjack@gmail.com',  // from email aka User/Client Email    'phone' => '1234567890',  // phone number aka User/Client Phone Number    'subject'   =>      'Test API message',  // test subject, aka Issue Summary    'message'   =>      'This is a test of the osTicket API',  // test ticket body, aka Issue Details.    'ip'        =>      $_SERVER, // Should be IP address of the machine thats trying to open the ticket.    'topicId'   =>      '1', // the help Topic that you want to use for the ticket     'notes' => 'This is a note of course of course.',);If a users does not exist it creates the user.email, name, phone, notesIt then creates a ticket with subject, message, up, topicID.So I don't follow you.

OK, so the phone number works. However, the user notes are not posted using the following...$name = 'TEST API USER';

$email = 'testuser@domain.com';

$mobile = '555 555 5555';

$subject = 'just testing';

$text = 'test message';

$notes = 'this is an internal note';

$data = array(

'name' => $name,

'email' => $email,

'phone' => $mobile,

'subject' => $subject,

'message' => $text,

'ip' => $_SERVER,

'notes' => $notes,

//'topicId' => '19' // Change to the id of your default topic.

);OST is not storing user notes...blankblank

With user notes I can pass private information such as user passwords which I don't want to send back and forth in ticket emails. Does anyone know another work around to achieve this? It doesn't appear that user notes via API works.

This works in my installation. (1.10.1 w/ php 7.0)

Should it work on 1.9.14, PHP 5.6?

No idea, I dont run older versions.  I'm not sure when 'notes' was introduced to the API.  It wasn't there in 1.8.x when i wrote my API help article thought.

13 days later

I can confirm that API internal notes do work in OST v1.10, PHP 5.6.

Write a Reply...