[rt-users] Perl script for RT ticket creation
Kevin Squire
gentgeen at wikiak.org
Fri Mar 5 12:55:13 EST 2010
Excuse me for grabbing this thread, but I think it is closely related...
Does anyone have a script that can be run via cron that would parse a
standard "RT Offline" formatted file and create new tickets?
(We have a process where a user uploads a CSV file received from an
outside client into a PHP webform, and the PHP converts it into a RT
Offline file, and then the user can copy/paste into RT. I would like
to take out the copy/paste step)
On Fri, 5 Mar 2010 09:17:34 +1100
Stuart Browne <stuart.browne at ausregistry.com.au> wrote:
> > From: badreddine meherzi
> >
> > I'm new on RT and I want to write a perl script that creates
> > a ticket in RT, so how can I proceed, wich are the Perl modules
> > that I have to install and is there an example of Perl script
> > creating an RT ticket(that would helps me a lot).
>
> This is parts scraped from what I use:
>
> #!/usr/bin/perl -w
> use strict;
> use RT::Client::REST;
> my $user = '';
> my $pass = ''
> my $url = '';
> my $subject = '';
> my $text_body = '';
>
> my $_RT = RT::Client::REST->new(
> server => $url,
> timeout => 30,
> );
> if (!$_RT->login(
> username => $user,
> password => $pass,
> )) {
> die ("Couldn't perform the login process\n");
> }
>
> my $number = $_RT->create(
> type => 'ticket',
> set => {
> queue => 'Incident Response',
> status => 'new',
> owner => 'nobody',
> requestor => $user,
> subject => $subject,
> },
> text => $text_body,
> );
>
> if ($number > 0) {
> print "Ticket $number created successfully\n";
> }
> exit(0);
> 1;
>
>
> Stuart J. Browne
> Senior Unix Administrator, Network Administrator
> AusRegistry Pty Ltd
> Level 8, 10 Queens Road
> Melbourne. Victoria. Australia. 3004.
> Ph: +61 3 9866 3710
> Fax: +61 3 9866 1970
> Email: stuart.browne at ausregistry.com.au
> Web: www.ausregistry.com.au
>
> The information contained in this communication is intended for the
> named recipients only. It is subject to copyright and may contain
> legally privileged and confidential information and if you are not an
> intended recipient you must not use, copy, distribute or take any
> action in reliance on it. If you have received this communication in
> error, please delete all copies from your system and notify us
> immediately. _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
> 2010 RT Training Sessions!
> San Francisco, CA, USA - Feb 22 & 23
> Dublin, Ireland - Mar 15 & 16
> Boston, MA, USA - April 5 & 6
> Washington DC, USA - Oct 25 & 26
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
--
http://www.wikiak.org
#############################################################
Associate yourself with men of good quality if you esteem
your own reputation; for 'tis better to be alone then in bad
company. - George Washington, Rules of Civility
More information about the rt-users
mailing list