RT3 Documentation

First off, could someone tell me where the various display fields for a
ticket are documented with precision? For example, what is the exact
meaning of ‘Told’, ‘Last Contact’, etc. I"ve looked at the ‘User Manual’
at http://wiki.bestpractical.com/, but it doesn’t seem to have enough
detail. Didn’t there used to be a full RT3 user manual in PDF, that had
more detail?

I’m trying to convert my RT2 perl scripts to use the RT3 ‘rt’ command as
an interface, just as I do now with RT2. I know that the API would be
better, but I have yet to find out enough information on how to use the
API. People have told me to look at the source, but that doesn’t help
enough when I don’t yet know the basic protocol. (For example, what
‘setup’ does each script need: e.g., which modules do I need to include
in my scripts, what does each one do, how to I retrieve return values and
return codes from each method call, etc.). I’ve been looking at sample
scripts and the source for the RT3 library modules, but that still doesn’t
explain to me the meaning of the basic perl module components that are
needed by any perl script that is talking to the RT API. An API document,
such as one can get for CPAN perl modules, would be a very good start.

Even better might be sample code to perform functions like this:

Create a ticket
Change a ticket’s queue, status, etc.
Merge tickets
Find last date/time a ticket was updated (*)
Search for a ticket with a particular subject line

And with the API, I’d hope to be able to check return status to know if
the operation succeeded or why it failed.

Thanks.

Mike

(*) I’m trying to see how I can determine from a script when a ticket was
last updated (whether by correspondence, comment or change in status).
This seems to be one of the few things I can’t do with the ‘rt’ command.
The web interface shows a ‘Last Contact’ field, but that value is not set
in the tickets in my database, even though there has been correspondence
on the tickets. (In RT2, there was a ‘last updated’ field, which is
really what I need).

Mike Friedman System and Network Security
mikef@ack.Berkeley.EDU 2484 Shattuck Avenue
1-510-642-1410 University of California at Berkeley
http://ack.Berkeley.EDU/~mikef http://security.berkeley.edu

Mike Friedman wrote:

First off, could someone tell me where the various display fields for a
ticket are documented with precision? For example, what is the exact
meaning of ‘Told’, ‘Last Contact’, etc. I"ve looked at the ‘User Manual’
at http://wiki.bestpractical.com/, but it doesn’t seem to have enough
detail. Didn’t there used to be a full RT3 user manual in PDF, that had
more detail?
No

I’m trying to convert my RT2 perl scripts to use the RT3 ‘rt’ command as
an interface, just as I do now with RT2. I know that the API would be
better, but I have yet to find out enough information on how to use the
API. People have told me to look at the source, but that doesn’t help
enough when I don’t yet know the basic protocol. (For example, what
‘setup’ does each script need: e.g., which modules do I need to include
in my scripts, what does each one do, how to I retrieve return values and
return codes from each method call, etc.). I’ve been looking at sample
scripts and the source for the RT3 library modules, but that still doesn’t
explain to me the meaning of the basic perl module components that are
needed by any perl script that is talking to the RT API. An API document,
such as one can get for CPAN perl modules, would be a very good start.
Start from external utils on
Request Tracker Wiki

Even better might be sample code to perform functions like this:

Create a ticket
html/Ticket/Create.html parse form and create new ticket

Change a ticket’s queue, status, etc.
html/Ticket/ModifyPeople.html
Merge tickets
html/Ticket/ModifyLinks.html
Find last date/time a ticket was updated (*)
$Ticket->LastUpdated; # returns ISO formated date
$Ticket->LastUpdatedObj; # return RT::Date obj.
Search for a ticket with a particular subject line
my $Tickets = RT::Tickets->new( $RT::SystemUser );
$Tickets->Limit(FIELD => ‘Subject’, OPERATOR => ‘LIKE’, VALUE => ‘Foo’);
print $Tickets->Count;

Start from external utils on
Request Tracker Wiki

Ruslan,

Thanks for your suggestions. They do, however, illustrate the very
problem I’m having, given the limited time available to me for reading
html source, or possibly dozens of different scripts, in order to learn
about every possible field I might eventually want to deal with.
(Incidentally, our use of RT here is heavily based on external perl
scripts, so I want to be in a position to write ones in the future without
having to find and study more samples every time I need to accomplish a
new function).

Create a ticket
html/Ticket/Create.html parse form and create new ticket
Change a ticket’s queue, status, etc.
html/Ticket/ModifyPeople.html
Merge tickets
html/Ticket/ModifyLinks.html
Find last date/time a ticket was updated (*)

Is there an easy way for me to view these html files?

$Ticket->LastUpdated; # returns ISO formated date
$Ticket->LastUpdatedObj; # return RT::Date obj.

Search for a ticket with a particular subject line
my $Tickets = RT::Tickets->new( $RT::SystemUser );
$Tickets->Limit(FIELD => ‘Subject’, OPERATOR => ‘LIKE’, VALUE => ‘Foo’);
print $Tickets->Count;

OK, those examples show how to do specific things. But that’s just it:
they’re specific. Suppose I want some variation. I’d still need to know
what other fields are available. For example, in the last sample above,
you show how to display the Count, but what if I want to display the ID
and the contents of each subject line for each ticket found. What are the
field names for those?

This is why I regret the absence of a simple API definition document that
I could use as reference whenever I need to accomplish a new function.

Even the perl ‘housekeeping’ that I see in various sample scripts, e.g.,

use RT;
use RT::Interface::CLI qw(CleanEnv);
use RT::Ticket;

CleanEnv();
RT::LoadConfig();
RT::Init();

must, it seems, be taken ‘on faith’. When are each of the above ‘used’
modules needed? What do ‘CleanEnv()’, ‘LoadConfig()’ and ‘Init()’ actually
do? Are they always necessary?

And, for example, if I see code like this:

my $queue = new RT::Queue($RT::SystemUser);

I find myself wondering: what is ‘SystemUser’? And isn’t ‘$RT’ (as
opposed to ‘RT’) a perl variable? If so, where is it set?

These are just some questions that occur to me as I read the sample
scripts and try to understand the API, so that as I write new scripts of
my own I know what I’m doing.

Thanks again; I do appreciate your hints. But given the time I have to
convert my scripts for RT3 (and position myself to write additional
scripts later), I’m still leaning toward the use of the ‘rt’ command,
which at least appears to be fully documented.

Mike

Mike Friedman System and Network Security
mikef@ack.Berkeley.EDU 2484 Shattuck Avenue
1-510-642-1410 University of California at Berkeley
http://ack.Berkeley.EDU/~mikef http://security.berkeley.edu