Get ticket content message using RT::Extension::REST2

Hi All, i want how to get the content of ticket using the id. I am able to get the ticket infos like subject, created date, due date, the ownet,… But i can’t see the ticket content in the json data sent by the API.

You can take a look at this documentation:

https://docs.bestpractical.com/rt/5.0.0/RT/REST2.html#Transactions

Seems ticket/id/history will work

Thanks for your help. But i think that the REST2 API not work with RT 5. I tried to use them to gether and i got a notification like RT Extension REST2 not compatible with RT5. Now i am using the RT4.4 with REST2 Extension and i am not able to get the ticket content. Thanks again for your support

Rest2 is core in RT 5 so you can remove the plugin line enabling the plug-in

Ok thanks tha is good i will exploit this path

I am having the same issues with REST2.

I can get the ticket history transaction ids with this.
/REST/2.0/ticket/1/history

And then i get the transactions using
/REST/2.0/transaction/:id

In there I expect to get the Description and Content of the transaction but that is not included in the response. Is there some way to add it?

Oh now I see that i need to loop through the attachment of a transaction to get the content of a comment for example…

So in order to get a full list of history on a ticket i need to …

  1. GET /REST/2.0/ticket/:id/history
  2. Loop through and get all transactions GET /REST/2.0/transaction/:id
  3. Loop through and get all attachments with GET /REST/2.0/attachment/:id

This is a really slow process… Could you not enable to get everything in bulk with a single GET ?

You can get all the transactions in one query, for example for ticket 1234:

curl -u username:password -XPOST \
  https://rt.server/REST/2.0/transactions \
  --data-binary '[{"field": "ObjectType", "value": "RT::Ticket"}, {"field": "ObjectId", "value": 1234}]'

Fetching all the attachments in one query could be an issue as it could be pretty big!