[rt-users] Extract ticket contents into file(s)

Mark Komarinski mark_komarinski at hms.harvard.edu
Wed Mar 27 13:37:59 EDT 2013


On 03/27/2013 01:29 PM, Ruslan Zakirov wrote:
> On Tue, Mar 26, 2013 at 10:52 PM, Mark Komarinski
> <mark_komarinski at hms.harvard.edu> wrote:
>> On 03/26/2013 02:33 PM, ktm at rice.edu wrote:
>>>
>>>
>>> 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 at hms.harvard.edu
Manager					http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School



More information about the rt-users mailing list