Leif Paisen
Leif Paisen

Reputation: 51

osticket api get tickets

I'm currently working with the osTicket API to realize a ticket-system on my website. I already found a way to create tickets with the downloaded example for the osTicket API. But now, I need to get the ticket information via the API, so I can display answers of the ticket on my website. I searched a lot of hours on google but can't find any example or any API references to get ticket informations from the API. Anybody have some code examples or links for me? I really tried my best to find any help on the internet but found nothing.. Best reagards Leif

Upvotes: 5

Views: 4769

Answers (3)

Amal Magdy
Amal Magdy

Reputation: 197

We have the same issue at our business.so, we expanded API functions to manage ticket operations as :

  • retrieve ticket details.
  • get list of tickets issued by one user.
  • get list of tickets assigned to an agent (staff member).
  • post a reply message to one ticket with updated status. i.e. change ticket status from open to closed.

[APIs implementaion] https://github.com/osTicket/osTicket/pull/4361/files

Upvotes: 4

Vinit M
Vinit M

Reputation: 11

SELECT ticket_id,
       t.number, 
       t.ticket_id, 
       address, 
       Ifnull(Concat(st.firstname, ' ', st.lastname), 'No Assignee') assigned, 
       subject, 
       t.created, 
       t.updated ticket_updated, 
       t.isoverdue 
FROM ost.`ost_ticket` t 
INNER JOIN ost.ost_ticket__cdata USING(ticket_id) 
LEFT JOIN ost.ost_user_email USING (user_id) 
LEFT JOIN ost.ost_user ou ON ou.id = t.user_id 
LEFT JOIN ost.ost_staff st USING (staff_id) 
WHERE t.status_id = '1' AND ( t.isanswered = 0 OR t.isoverdue = 1 )

for OS ticket 1.10 I have tested

Upvotes: 1

Leif Neland
Leif Neland

Reputation: 1528

I simply made a script to get the needed value directly from the ticket mysql database.

SELECT ticketid, 
   t.ticket_id, 
   address, 
   Ifnull(Concat(st.firstname, ' ', st.lastname), 'No Assignee') assigned, 
   subject, 
   t.created, 
   t.updated 
   ticket_updated, 
   t.isoverdue 
FROM   ost.`ost_ticket` t 
   INNER JOIN ost.ost_ticket__cdata USING(ticket_id) 
   LEFT JOIN ost.ost_user_email USING (user_id) 
   LEFT JOIN ost.ost_user ou 
          ON ou.id = t.user_id 
   LEFT JOIN ost.ost_staff st USING (staff_id) 
WHERE  t.status = 'Open' 
   AND ( t.isanswered = 0 
          OR t.isoverdue = 1 ) 

This I then format as json, but I leave that as an exercise to the reader ;-)

Upvotes: 0

Related Questions