wardmw has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I am trying to access a ticket in an RT system with the intention of downloading the attachments for further processing and I am using v0.49 of the rt::client::rest API library.
Unfortunately I seem to have hit a bug in the code. Below is the relevant code piece:
Running the above causes the code to print out a few transactions that don't have file names and then crash with:... try { # Try and find some tickets @search = $rt->search(type => 'ticket', query => "id = '3188'" +); } catch RT::Client::REST::UnauthorizedActionException with { print STDERR "You are not authorized to execute this search.\n +"; } catch RT::Client::REST::Exception with { # something went wrong. die "Problem trying to execute a search: ", shift->message; }; exit 0 if (scalar(@search) < 1); foreach $id (@search) { # Retrieve each ticket from RT $ticket = $rt->show(type => 'ticket', id => $id); @attachment_ids = $rt->get_attachment_ids (id => $id); foreach(@attachment_ids) { print "Att_id: $_\n"; $att = $rt->get_attachment (parent_id => $id, id => $_ +); print Dumper($att); print "\n"; } }
The error is caused inside the call to get_attachment(). Does anyone have any example code that does retrieve file attachments or have an explanation to why I get the above error?Use of uninitialized value in split at /usr/lib/perl5/site_perl/5.8.8/ +RT/Client/REST/Forms.pm line 38. Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/s +ite_perl/5.8.8/RT/Client/REST.pm line 167.
|\\/|artin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing attachments using RT::Client::REST
by kcott (Archbishop) on Dec 03, 2015 at 08:04 UTC | |
by wardmw (Acolyte) on Dec 03, 2015 at 14:35 UTC | |
|
Re: Accessing attachments using RT::Client::REST
by dmitri (Priest) on Dec 16, 2015 at 17:00 UTC |