> 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: [email protected]
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: [email protected]

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

Reply via email to