Extract ticket contents into file(s)

I’m writing here while I do my own investigation due to time constraints.

I got a request from a set of RT users to get the ticket contents in a
file that can be parsed to categorize the ticket purpose. Setting aside
the fact that custom fields would have prevented this, if there’s a
snippet of code out there that can extract that information from a given
ticket, I think I can build the rest.

Anyone else run into this situation?

-Mark

Mark Komarinski mark_komarinski@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School

I’m writing here while I do my own investigation due to time constraints.

I got a request from a set of RT users to get the ticket contents in
a file that can be parsed to categorize the ticket purpose. Setting
aside the fact that custom fields would have prevented this, if
there’s a snippet of code out there that can extract that
information from a given ticket, I think I can build the rest.

Anyone else run into this situation?

-Mark


Mark Komarinski mark_komarinski@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School

Hi Mark,

I think the REST interface can do what you want:

http://requesttracker.wikia.com/wiki/REST

Regards,
Ken

I think the REST interface can do what you want:

http://requesttracker.wikia.com/wiki/REST

ticket/#/history?format=l looks like it might do what I need. Thanks!

-Mark

Mark Komarinski mark_komarinski@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School

I think the REST interface can do what you want:

http://requesttracker.wikia.com/wiki/REST

ticket/#/history?format=l looks like it might do what I need. Thanks!

Dirty version using API:

my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load(1234567890);
my $txns = $ticket->Transactions;
while (my $txn = $txns->Next ) {

print $txn->Content, "\n\n";

}

-Mark


Mark Komarinski mark_komarinski@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School

Best regards, Ruslan.

I think the REST interface can do what you want:

http://requesttracker.wikia.com/wiki/REST

ticket/#/history?format=l looks like it might do what I need. Thanks!

Dirty version using API:

my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load(1234567890);
my $txns = $ticket->Transactions;
while (my $txn = $txns->Next ) {

 print $txn->Content, "\n\n";

}

I did a variation on the REST example:

my $response = $ua->post($uri.“ticket/$ticketNumber/history?format=l”,
[‘user’ => $access_user, ‘pass’ => $access_password],
‘Content_Type’ => ‘form-data’);

if ($response->is_success) {
print $response->decoded_content;
}

Threw in a sleep between each ticket to keep from overloading the RT
server, and I got everything I needed.

I’ll try perl next time around and see if it’s any faster.

-Mark

Mark Komarinski mark_komarinski@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School