Trouble with API

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
LBNL

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);

~JasonOn 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
LBNL


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@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@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. |
------------------------------------------------------------------/

smime.p7s (3.81 KB)