RT error using API in program

To all,

We are writing a program to move an old legacy system into RT using 

Perl/API. When we try to create a ticket we get an error on “creator”.

There appears to be a bug in the API. Normal behavior when I call 

$ticket->Create() is for it to convert LDAP style strings in the
argument hash into the corresponding numeric ids before doing the actual
database insert. If you look at the following, you will see that it does
so in several cases, eg “Owner”, “Queue”, but fails to do so in the
case of field “Creator”, trying to insert ‘DMuirduchann’ instead of the
corresponding numeric. I thought this might be because DMuirduchann is
not a pre-existing user, but replacing DMuirduchann with FCHanny, which
it correctly translates for other fields, yields the same error. See
following:

[Tue Nov 25 19:53:42 2008] [warning]: DBD::Oracle::st execute failed:
ORA-01722: invalid number (DBD ERROR: error possibly near <> indicator a
t char 242 in 'INSERT INTO Tickets (Status, Queue, Started, Type,
InitialPriority, Starts, id, LastUpdated, Subject, FinalPriority,
Creator, Ow
ner, LastUpdatedBy, Resolved, Created, Priority, Due) VALUES (:p1, :p2,
:p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :<
>p11, :p12, :p13, :p14, :p1
5, :p16, :p17)’) [for Statement “INSERT INTO Tickets (Status, Queue,
Started, Type, InitialPriority, Starts, id, LastUpdated, Subject, FinalPri
ority, Creator, Owner, LastUpdatedBy, Resolved, Created, Priority, Due)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)” with ParamV
alues: :p5=‘5’, :p12=‘9824’, :p8=‘2008-01-04 12:00:00’, :p14=‘1970-01-01
00:00:00’, :p10=‘1’, :p13=‘1’, :p16=‘5’, :p2=‘50252’, :p3=‘2007-11-28
12:00:00’, :p6=‘1970-01-01 00:00:00’, :p15=‘2007-11-28 12:00:00’,
:p1=‘open’, :p7=‘57389’, :p17=‘1970-01-01 00:00:00’, :p4=‘ticket’,
:p9=‘Chg R
eq 17830: Data Conflict error’, :p11=‘DMuirduchann’] at
/apps/rt/rt/perl/lib/5.8.5/DBIx/SearchBuilder/Handle.pm line 505.
(/apps/rt/rt/perl/lib
/5.8.5/DBIx/SearchBuilder/Handle.pm:505)

Kenn
LBNL

To all,

We are writing a program to move an old legacy system into RT using
Perl/API. When we try to create a ticket we get an error on “creator”.

There appears to be a bug in the API. Normal behavior when I call
$ticket->Create() is for it to convert LDAP style strings in the
argument hash into the corresponding numeric ids before doing the actual
database insert. If you look at the following, you will see that it does
so in several cases, eg “Owner”, “Queue”, but fails to do so in the
case of field “Creator”, trying to insert ‘DMuirduchann’ instead of the
corresponding numeric. I thought this might be because DMuirduchann is
not a pre-existing user, but replacing DMuirduchann with FCHanny, which
it correctly translates for other fields, yields the same error. See
following:

[Tue Nov 25 19:53:42 2008] [warning]: DBD::Oracle::st execute failed:
ORA-01722: invalid number (DBD ERROR: error possibly near <> indicator a
t char 242 in 'INSERT INTO Tickets (Status, Queue, Started, Type,
InitialPriority, Starts, id, LastUpdated, Subject, FinalPriority,
Creator, Ow
ner, LastUpdatedBy, Resolved, Created, Priority, Due) VALUES (:p1, :p2,
:p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :<
>p11, :p12, :p13, :p14, :p1
5, :p16, :p17)') [for Statement “INSERT INTO Tickets (Status, Queue,
Started, Type, InitialPriority, Starts, id, LastUpdated, Subject,
FinalPri
ority, Creator, Owner, LastUpdatedBy, Resolved, Created, Priority, Due)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)” with ParamV
alues: :p5=‘5’, :p12=‘9824’, :p8=‘2008-01-04 12:00:00’, :p14=‘1970-01-01
00:00:00’, :p10=‘1’, :p13=‘1’, :p16=‘5’, :p2=‘50252’, :p3=‘2007-11-28
12:00:00’, :p6=‘1970-01-01 00:00:00’, :p15=‘2007-11-28 12:00:00’,
:p1=‘open’, :p7=‘57389’, :p17=‘1970-01-01 00:00:00’, :p4=‘ticket’,
:p9=‘Chg R
eq 17830: Data Conflict error’, :p11=‘DMuirduchann’] at
/apps/rt/rt/perl/lib/5.8.5/DBIx/SearchBuilder/Handle.pm line 505.
(/apps/rt/rt/perl/lib
/5.8.5/DBIx/SearchBuilder/Handle.pm:505)

Kenn,

The ticket Create API doesn’t convert creator name to id for you - you’ll
need to supply the creator’s id instead of their username. This will
entail looking up the User object by name before the ticket create.

Steve

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

Stephen Turner
Senior Programmer/Analyst - SAIS
MIT IS&T

To all,

We are writing a program to move an old legacy system into RT using
Perl/API. When we try to create a ticket we get an error on “creator”.

There appears to be a bug in the API. Normal behavior when I call
$ticket->Create() is for it to convert LDAP style strings in the
argument hash into the corresponding numeric ids before doing the actual
database insert. If you look at the following, you will see that it does
so in several cases, eg “Owner”, “Queue”, but fails to do so in the
case of field “Creator”, trying to insert ‘DMuirduchann’ instead of the
corresponding numeric. I thought this might be because DMuirduchann is
not a pre-existing user, but replacing DMuirduchann with FCHanny, which
it correctly translates for other fields, yields the same error. See
following:

Creator and LastUpdatedBy are expected to be ids, not user names.