Hi everyone, I’m new to RT but have set it up and we are currently using it.
I want to have new tickets send out an iPhone Push Notification. I’ve
already written an HTTP API to use for it, and I created a custom
Scrip in RT to send the request to the API.
Here is my code:
Custom action preparation code:
return 1;
Custom action cleanup code:
$request = HTTP::Request->new(GET => ‘http://url/to/api’);
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
return 1;
Unfortunately that URL GET request never get’s called. I know the
action is running because if I add code to change the ticket priority
it works.
Is there something I need to do to be able to use the HTTP::Request object?
Thanks for any tips you can help me with!
Nevermind, I got it working by using this code instead for the cleanup code:
my $url = ‘http://url/api’;
use LWP::Simple;
my $content = get $url;
return 1;
Thanks! Maybe this will help someone else one day.On Fri, Sep 9, 2011 at 3:35 PM, Arthur Wiebe arthur@nerdsonsite.com wrote:
Hi everyone, I’m new to RT but have set it up and we are currently using it.
I want to have new tickets send out an iPhone Push Notification. I’ve
already written an HTTP API to use for it, and I created a custom
Scrip in RT to send the request to the API.
Here is my code:
Custom action preparation code:
return 1;
Custom action cleanup code:
$request = HTTP::Request->new(GET => ‘http://url/to/api’);
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
return 1;
Unfortunately that URL GET request never get’s called. I know the
action is running because if I add code to change the ticket priority
it works.
Is there something I need to do to be able to use the HTTP::Request object?
Thanks for any tips you can help me with!
Nevermind, I got it working by using this code instead for the cleanup code:
my $url = ‘http://url/api’;
use LWP::Simple;
my $content = get $url;
return 1;
Thanks! Maybe this will help someone else one day.
In case people need more info, LWP has a cookbook:
http://search.cpan.org/dist/libwww-perl/lwpcook.pod
Best regards, Ruslan.