[rt-users] Trouble with API

Jason A. Smith smithj4 at bnl.gov
Thu Nov 20 20:52:06 EST 2008

Hi Kenn,

We have a script that sometimes creates tickets in RT using the perl
API, by doing something like:

# If we have an RT user's name or email address:
#  - Of course this user must have 'CreateTicket' rights.
my $CurrentUser = RT::CurrentUser->new;
$CurrentUser->LoadByName('RTName');  # Or use: LoadByEmail('EmailAddr');

# Otherwise we just have the ticket created by the RT system User:
my $UserObj = RT::User->new($RT::SystemUser);
my $CurrentUser = $UserObj->CurrentUser;

# First create a MIME Object to put the ticket text into:
my $MIMEObj = MIME::Entity->build(From    => 'from',
                                  Subject => 'subject',
                                  Data    => 'message text',

# Then create the ticket, where the %ARGS hash contains all the ticket
# data, like: Queue, Owner, Requestor, Subject & MIMEObj:
my $Ticket = RT::Ticket->new($CurrentUser);
my ($Id, $Transaction, $ErrStr) = $Ticket->Create(%ARGS);

# To make extra replies or comments to the ticket, just do things like:
$Ticket->Correspond(MIMEObj => $MIMEObj);
$Ticket->Comment(MIMEObj => $MIMEObj);


On Thu, 2008-11-20 at 14:56 -0800, Kenneth Crocker wrote:
> To All,
> 	We are trying to run perl program using API. It won't let us create any 
> tickets. We keep getting an error saying we don't have privileges to 
> create tickets in the queue we are trying this on.
> 	First question, when using API, what user are we signed in on? 
> RT_System? If so, how do we get that user privileges for creating 
> tickets in a queue? Can we access that User? We can't seem to find any 
> documentation on this part. Thanks in advance for your help.
> P.S. Hopefully, when we get this running, we'll have a conversion 
> program to share that will allow you to read a legacy DB and write your 
> records into RT.
> Kenn
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
|  Jason A. Smith                          Email:  smithj4 at bnl.gov |
|  Atlas Computing Facility, Bldg. 510M    Phone: +1-631-344-4226  |
|  Brookhaven National Lab, P.O. Box 5000  Fax:   +1-631-344-7616  |
|  Upton, NY 11973-5000,  U.S.A.                                   |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3898 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20081120/6bd834d3/attachment.bin>

More information about the rt-users mailing list