Export ALL Tickets including CFs, Attachments, History, Comment to CSV or Json

Hallo everyone,

is there anyone who knows how I can export all my tickets ( including CFs, Attachments, History Comment) on RT to CSV or Json. The method is not important via sql query, a perl script or an easy way to do it. The question is how?

By the time I am using the version of RT 3.8.8, if it would be necessary

What I tried before;

1-I tried to do via perl script but I had connection problem.
The perl scripts were;

Firstly for testing the connection;
**Secondly I would try the way that someone adviced before;


use Error qw(:try);
use RT::Client::REST;

my $user = “x”;
my $pass = “.”;
my $rt = RT::Client::REST->new(
server => ‘https://www…/’,
timeout => 30,

try {
$rt->login(username => $user, password => $pass);
} catch Exception::Class::Base with {
die "problem logging in: ", shift->message;

try {

Get ticket #10

$ticket = $rt->show(type => ‘ticket’, id => 62484);
} catch RT::Client::REST::UnauthorizedActionException with {
print “You are not authorized to view ticket #10\n”;
} catch RT::Client::REST::Exception with {

something went wrong.

**----------------RESPONSE WAS PROBLEM LOGGING IN . CANNOT CONNECT to www.pegaware.com:443

Using other Rest API Tools such as Postman I have no problem with my user type to get data. But I could not get all of tickets vie one query.

Would greatly appreciate if someone could provide guidance around capturing all ticket info in the output file.


I haven’t used the REST1.0 interface and i am not sure if REST2 would be supported on your version of RT. You could create a RT script that you run from the server that does this, I think getting some of the data like transactions and attachments could get tricky though if you’re not familiar with RT.

What’re you trying to do with the data, maybe there is an easier way to achieve the goal?

Am I right in thinking that RT 3.8.8 doesn’t have the sbin/rt-serializer script? If it does you might want to look at that, as it dumps the contents of different aspects of the RT database into a file. This makes use of the library code in lib/RT/Migrate/Serializer.pm.

Even if you don’t have this in 3.8.8, it might be worth taking a look at the current code as it might give some hints and show up potential pitfalls. Remember that RT tickets have transaction histories, that include references to queues, etc, so you might find you’re having to export quite a bit more than you expect (for example queue object history, users, etc).

how could I do that?
I want to output all tickets to CSV or Json File (Attachment should preferably be named with their paths)
and than I would import to Jira

I am not so much familiar with this kind of script. Would greatly appreciate if you can explain one by one

Do you know whether it is possible getting attachment from dump file? Or is there any other easier method you have?

Thanks a lot for your response

Actually that’s why I am here :slight_smile:

Look at your RT installation and see if there’s a sbin directory and if so, is there a rt-serializer script in it?

If there is, that can be used to generate a data structure in files that you could then process into whatever format you need (JSON, CSV). You’ll probably need to do some programming though even then, as the rt-serializer script generates a Perl Storable output I think. Its actually intended for dumping out one RT database instance for loading into another RT instance (using rt-importer) so if you’re trying to load it into something else you’ll need some processing anyway I would have thought.

Hi again,

due to access rights I could not try personally the solution purpose. Admin said that we have 10gb attachment on your project and it makes no sense. Therefore he gave me a dump file. It is not easy to understand how relations are.

Could you tell me, if you have a perl script, with it I could export my ticket according to a particular query? I may access with my rights to create new ticket on RT. Maybe a perl script could solve my issue without any extra enquiry.

I found this link but it has no connection rows. I am totally new for Perl. If it is logic, could you edit the code, which is on link.


Best regards,

Have you looked at: RT::Extension::TicketPDF - make pdfs from tickets. - metacpan.org

Thanks for your suggestion, but [RT::Extension::TicketPDF] is not covering my all needs. For example Attachment is missing.

Have you a suggestion relevant to Perl Script?

I do not have a script that I have used before the one you pointed to seems like a good start, I think it will be complicated to grab all the data from a ticket. I think your best bet is to still use the output from the rt-serializer like GreenJim said and write some code to take that and put it into a format that suits you