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

2013-03-27 Thread Mark Komarinski

On 03/27/2013 01:29 PM, Ruslan Zakirov wrote:

On Tue, Mar 26, 2013 at 10:52 PM, Mark Komarinski
 wrote:

On 03/26/2013 02:33 PM, k...@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_komarin...@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School


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

2013-03-27 Thread Ruslan Zakirov
On Tue, Mar 26, 2013 at 10:52 PM, Mark Komarinski
 wrote:
> On 03/26/2013 02:33 PM, k...@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";

}


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



-- 
Best regards, Ruslan.


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

2013-03-26 Thread Mark Komarinski

On 03/26/2013 02:33 PM, k...@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!

-Mark

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


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

2013-03-26 Thread k...@rice.edu
On Tue, Mar 26, 2013 at 02:09:51PM -0400, Mark Komarinski wrote:
> 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_komarin...@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


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

2013-03-26 Thread Mark Komarinski

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_komarin...@hms.harvard.edu
Manager http://ritg.med.harvard.edu
Research IT Group
Harvard Medical School