<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Robert+Brockway</id>
	<title>Request Tracker Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Robert+Brockway"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/wiki/Special:Contributions/Robert_Brockway"/>
	<updated>2026-08-22T03:31:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=CLI&amp;diff=26975</id>
		<title>CLI</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=CLI&amp;diff=26975"/>
		<updated>2020-07-02T03:11:47Z</updated>

		<summary type="html">&lt;p&gt;Robert Brockway: RTUSER variable wasn&amp;#039;t being formatted properly.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Guide to the RT Command Line Interface (CLI) =&lt;br /&gt;
&lt;br /&gt;
RT has a command line tool you can use to interact with your RT install. You can execute commands from your terminal with the &#039;rt&#039; command or launch the rt shell with &#039;rt shell&#039; and execute commands there.&lt;br /&gt;
&lt;br /&gt;
The nice thing about the RT CLI is you can run it on a different machine from your RT install.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Setting up a working environment for RT CLI ===&lt;br /&gt;
&lt;br /&gt;
Before you can start using the RT CLI you have to set up a working environment for your RT, here we have two possible ways:&lt;br /&gt;
&lt;br /&gt;
=== Environment Variables ===&lt;br /&gt;
&lt;br /&gt;
Setting environment variables is a good way to start using the CLI. The following variables could be defined:&lt;br /&gt;
&lt;br /&gt;
*RTUSER&lt;br /&gt;
*RTPASSWD&lt;br /&gt;
*RTSERVER&lt;br /&gt;
*RTDEBUG&lt;br /&gt;
*RTQUERY&lt;br /&gt;
*RTORDERBY&lt;br /&gt;
*RTCONFIG&lt;br /&gt;
*EDITOR or VISUAL&lt;br /&gt;
&lt;br /&gt;
You can set the important variables inside a BASH in this way:&lt;br /&gt;
&lt;br /&gt;
 export RTUSER=your.rtusername&lt;br /&gt;
 export RTPASSWD=your rt password&lt;br /&gt;
 export RTSERVER=http://your.rt3.installation&lt;br /&gt;
&lt;br /&gt;
=== RT Config File ===&lt;br /&gt;
&lt;br /&gt;
Create at the users Home Directory a .rtrc file with the following min. Options:&lt;br /&gt;
&lt;br /&gt;
 server http://your.rt3.installation&lt;br /&gt;
 user your.rtusername&lt;br /&gt;
 passwd your rt password&lt;br /&gt;
&lt;br /&gt;
Advanced settings can also be defined here:&lt;br /&gt;
&lt;br /&gt;
 query your default query string (&amp;quot;Status = &#039;new&#039; and Priority &amp;amp;gt; 5&amp;quot;)&lt;br /&gt;
 orderby your default sort order&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Let&#039;s start working with the CLI - the first call ===&lt;br /&gt;
&lt;br /&gt;
I assume you have installed RT with the default layout (/opt/rt3) then you can find the RT CLI executable under /opt/rt3/bin its called rt&lt;br /&gt;
&lt;br /&gt;
 [tbrumm@messenger ~]$ rt&lt;br /&gt;
 rt&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will bring you directly to the rt cli shell. Now lets try us to getting help:&lt;br /&gt;
&lt;br /&gt;
 [tbrumm@messenger ~]$ rt&lt;br /&gt;
 rt&amp;amp;gt; help&lt;br /&gt;
 &lt;br /&gt;
  ** THIS IS AN UNSUPPORTED PREVIEW RELEASE **&lt;br /&gt;
  ** PLEASE REPORT BUGS TO rt-bugs@bestpractical.com **&lt;br /&gt;
 &lt;br /&gt;
 This is a command-line interface to RT 3.0 or newer&lt;br /&gt;
 &lt;br /&gt;
 It allows you to interact with an RT server over HTTP, and offers an&lt;br /&gt;
 interface to RT&#039;s functionality that is better-suited to automation&lt;br /&gt;
 and integration with other tools.&lt;br /&gt;
 &lt;br /&gt;
 In general, each invocation of this program should specify an action&lt;br /&gt;
 to perform on one or more objects, and any other arguments required&lt;br /&gt;
 to complete the desired action.&lt;br /&gt;
 &lt;br /&gt;
 For more information:&lt;br /&gt;
 &lt;br /&gt;
     - rt help usage         (syntax information)&lt;br /&gt;
     - rt help objects       (how to specify objects)&lt;br /&gt;
     - rt help actions       (a list of possible actions)&lt;br /&gt;
     - rt help types         (a list of object types)&lt;br /&gt;
 &lt;br /&gt;
     - rt help config        (configuration details)&lt;br /&gt;
     - rt help examples      (a few useful examples)&lt;br /&gt;
     - rt help topics        (a list of help topics)&lt;br /&gt;
 &lt;br /&gt;
 rt&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
The normal usage looks like this:&lt;br /&gt;
&lt;br /&gt;
 rt &amp;amp;lt;action&amp;amp;gt; [options] [arguments]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;_The RT Actions:_&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can currently perform the following actions on all objects:&lt;br /&gt;
&lt;br /&gt;
 - list          (list objects matching some condition)&lt;br /&gt;
 - show          (display object details)&lt;br /&gt;
 - edit          (edit object details)&lt;br /&gt;
 - create        (create a new object)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;_The RT Objects:_&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every object in RT has a type (e.g. &amp;quot;ticket&amp;quot;, &amp;quot;queue&amp;quot;) and a numeric ID. Some types of objects can also be identified by name (like users and queues). Furthermore, objects may have named attributes (such as &amp;quot;ticket/1/history&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
An object specification is like a path in a virtual filesystem, with object types as top-level Directories, object [[IDs]] as subdirectories,and named attributes as further subdirectories.&lt;br /&gt;
&lt;br /&gt;
A comma-separated list of names, numeric [[IDs]], or numeric ranges can be used to specify more than one object of the same type. Note that the list must be a single argument (i.e., no spaces). For example, &amp;quot;user/root,1-3,5,7-10,ams&amp;quot; is a list of ten users; the same list can also be written as &amp;quot;user/ams,root,1,2,3,5,7,8-10&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;_The RT Types:_&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can currently operate on the following types of objects:&lt;br /&gt;
&lt;br /&gt;
 - tickets&lt;br /&gt;
 - users&lt;br /&gt;
 - groups&lt;br /&gt;
 - queues&lt;br /&gt;
&lt;br /&gt;
=== Working with Links via the CLI ===&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
 rt link [-d] &amp;amp;lt;id-A&amp;amp;gt; &amp;amp;lt;link&amp;amp;gt; &amp;amp;lt;id-B&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates (or, with -d, deletes) a link between the specified tickets. See &#039;rt help link&#039; for more details.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
To Make a new user:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt create -t users add Name=userName EmailAddress=email@address.com Password=password&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get a users information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt show user/userName&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a ticket in Quux:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt create -t ticket set subject=&#039;New ticket&#039; queue=Quux priority=10 add cc=foo@example.com&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To edit a &#039;&#039;Custom Field&#039;&#039; (use prefix &amp;lt;code&amp;gt;CF-&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt edit ticket/63066 set CF-Release-Status=&#039;Deployed&#039;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To show all info for a specific ticket:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt show ticket/3&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To show specific fields for a ticket:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt show -t ticket 42 -f id,subject,status,queue,owner,priority&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To show the history for a ticket:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt show ticket/42/history -f created,content,description&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a comment to a ticket:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;rt comment ticket/42 -m &amp;quot;this text will be added as a comment to the ticket&amp;quot;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make a report of tickets in a queue: not resolved, that are 30 days old:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;rt ls -o -Created -t ticket &amp;quot;Queue = &#039;4&#039; AND Status != &#039;resolved&#039; AND \&lt;br /&gt;
   Created &amp;amp;lt; &#039;30 days ago&#039;&amp;quot; -f id,subject,status,created,lastupdated,owner \&lt;br /&gt;
   | mail -s &amp;quot;Report of tickets 30 days old&amp;quot; username@email&lt;br /&gt;
   &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating tickets with multiple lines of text ===&lt;br /&gt;
&lt;br /&gt;
To Create a ticket with multiple lines of text in the body indent the lines with a space. Example:&lt;br /&gt;
&lt;br /&gt;
 rt create -t ticket set queue=myqueue subject=&amp;quot;MultiLine Test&amp;quot; text = &amp;quot;Line 1&lt;br /&gt;
  Line 2&lt;br /&gt;
  Line 3&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
To Enter multiple lines of text into the interactive Form, put a space at the begining of the second line, third line, etc. Example:&lt;br /&gt;
&lt;br /&gt;
 rt comment &amp;amp;lt;someticketnumber&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, if your editor is vi/m you see something like this:&lt;br /&gt;
&lt;br /&gt;
 Ticket: 1311875&lt;br /&gt;
 Action: comment&lt;br /&gt;
 Cc:&lt;br /&gt;
 Bcc:&lt;br /&gt;
 Attachment:&lt;br /&gt;
 TimeWorked:&lt;br /&gt;
 Text: now put your text here.&lt;br /&gt;
  begin each new line with a space !&lt;br /&gt;
  also this one. and so on...&lt;/div&gt;</summary>
		<author><name>Robert Brockway</name></author>
	</entry>
</feed>