in reply to Perl Acolyte in need for some guidance regarding RT integration with project management app.

Hi, welcome to Perl, the One True Religion.

RT::Client::REST looks good. Have you read the doc? Usually a decent Perl module on the CPAN will provide working code in the SYNOPSIS section. Another good place to look for samples is in the distribution's t/ test directory, where the author (should) exercise the code.

And in the case of this module, there is an extensive collection of examples in the examples/ directory.

From what I can see, you won't need to use LWP directly.

## https://metacpan.org/source/DJZORT/RT-Client-REST-0.56/examples/cre +ate_ticket.pl #!/usr/bin/perl # # create_ticket.pl -- create an RT ticket. use strict; use warnings; use RT::Client::REST; use RT::Client::REST::Ticket; unless (@ARGV >= 3) { die "Usage: $0 username password queue subject\n"; } my $rt = RT::Client::REST->new( server => ($ENV{RTSERVER} || 'http://rt.cpan.org'), ); $rt->login( username=> shift(@ARGV), password=> shift(@ARGV), ); print "Please enter the text of the ticket:\n"; my $text = join('', <STDIN>); my $ticket = RT::Client::REST::Ticket->new( rt => $rt, queue => shift(@ARGV), subject => shift(@ARGV), )->store(text => $text); use Data::Dumper; print Dumper($ticket);

Hope this helps!


The way forward always starts with a minimal test.
  • Comment on Re: Perl Acolyte in need for some guidance regarding RT integration with project management app.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Perl Acolyte in need for some guidance regarding RT integration with project management app.
by skepticdev (Novice) on Apr 21, 2020 at 18:09 UTC

    I haven't seen the examples section of CPAN before, this was really useful. But, please correct me if I am wrong, what I get from that code example for "use RT::Client::REST::Ticket" is that it triggers the creation of a new RT ticket, whereas what I need to do is the opposite.

    Users will create tickets manually in our RT help desk, this event should trigger a script that connects to Project Open's API (http://www.project-open.net/en/package-intranet-rest) passing values from the RT ticket created by the user in order to trigger the creation of a corresponding ticket IN Project Open (Not a new RT Ticket). It should then return from Project Open with some information regarding this new PO ticket that I will use to update the status of the ticket created manually by the user in the first place

    To sum up what I need to understand is:

    1) How to use these modules to pass the desired values from RT to Project Open

    2) In the same script I passed these values I need to trigger Project Open's ticket creation method

    3) Return to RT with information about the new ticket created in Project Open which I will use in a new and simple script to update the status of our client's request

      Hi again, check out REST::Client which you can configure to connect to any Restful API, which Project Open appears to be.

      Update: Usually, REST APIs pass data back and forth serialized as JSON. Your script's request routine would serialize the data from the RT ticket to a JSON obj and pass that to Project Open in the body of the API request. The response content will likely also be a JSON object which the response processing routine in your script would deserialize and then use as Perl data.

      Hope this helps!


      The way forward always starts with a minimal test.