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

Include Internal Notes in API Ticket

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['REMOTE_ADDR'],
);
set_time_limit(30);
$options = array(
'http' => array(
'header' => "X_API_Key: ".$config['key'],
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($config['url'], 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://osticket.com/forum/discussion/4326/show-internal-notes-inline-with-ticket-thread
http://osticket.com/forum/discussion/88641/add-notes-to-ticket-via-api
http://osticket.com/forum/discussion/88947/internal-comment-with-api

This ability is essential for us and I'm sure others. Is there any way to achieve this?

Tagged:

Comments

  • sure is quiet here
  • edited February 12

    Given 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['REMOTE_ADDR'], // 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, notes

    It then creates a ticket with 
    subject, message, up, topicID.

    So I don't follow you.
  • edited February 12
    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['REMOTE_ADDR'],
    'notes' => $notes,
    //'topicId' => '19' // Change to the id of your default topic.
    );


    OST is not storing user notes...

    image


    image

  • 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.
Sign In or Register to comment.