1RT::Client::REST::TickeUts(e3r)Contributed Perl DocumentRaTt:i:oCnlient::REST::Ticket(3)
2
3
4
6 RT::Client::REST::Ticket -- this object represents a ticket.
7
9 my $rt = RT::Client::REST->new(server => $ENV{RTSERVER});
10
11 # Create a new ticket:
12 my $ticket = RT::Client::REST::Ticket->new(
13 rt => $rt,
14 queue => "General",
15 subject => $subject,
16 )->store(text => "This is the initial text of the ticket");
17 print "Created a new ticket, ID ", $ticket->id, "\n";
18
19 # Update
20 my $ticket = RT::Client::REST::Ticket->new(
21 rt => $rt,
22 id => $id,
23 priority => 10,
24 )->store;
25
26 # Retrieve
27 my $ticket => RT::Client::REST::Ticket->new(
28 rt => $rt,
29 id => $id,
30 )->retrieve;
31
32 unless ($ticket->owner eq $me) {
33 $ticket->steal; # Give me more work!
34 }
35
37 RT::Client::REST::Ticket is based on RT::Client::REST::Object. The
38 representation allows to retrieve, edit, comment on, and create tickets
39 in RT.
40
42 id
43 This is the numeric ID of the ticket.
44
45 queue
46 This is the name of the queue (not numeric id).
47
48 owner
49 Username of the owner.
50
51 creator
52 Username of RT user who created the ticket.
53
54 subject
55 Subject of the ticket.
56
57 status
58 The status is usually one of the following: "new", "open",
59 "resolved", "stalled", "rejected", and "deleted". However, custom RT
60 installations sometimes add their own statuses.
61
62 priority
63 Ticket priority. Usually a numeric value.
64
65 initial_priority
66 final_priority
67 requestors
68 This is a list attribute (for explanation of list attributes, see
69 LIST ATTRIBUTE PROPERTIES in RT::Client::REST::Object). Contains
70 e-mail addresses of the requestors.
71
72 cc
73 A list of e-mail addresses used to notify people of 'correspond'
74 actions.
75
76 admin_cc
77 A list of e-mail addresses used to notify people of all actions
78 performed on a ticket.
79
80 created
81 Time at which ticket was created.
82
83 starts
84 started
85 due
86 resolved
87 told
88 time_estimated
89 time_worked
90 time_left
91 last_updated
92
94 For full explanation of these, please see "DB METHODS" in
95 RT::Client::REST::Object documentation.
96
97 retrieve
98 Retrieve RT ticket from database.
99
100 store ([text => $text])
101 Create or update the ticket. When creating a new ticket, optional
102 'text' parameter can be supplied to set the initial text of the
103 ticket.
104
105 search
106 Search for tickets that meet specific conditions.
107
109 comment (message => $message, %opts)
110 Comment on this ticket with message $message. %opts is a list of
111 key-value pairs as follows:
112
113 attachments
114 List of filenames (an array reference) that should be attached to
115 the ticket along with the comment.
116
117 cc
118 List of e-mail addresses to send carbon copies to (an array
119 reference).
120
121 bcc
122 List of e-mail addresses to send blind carbon copies to (an array
123 reference).
124
125 correspond (message => $message, %opts)
126 Add correspondence to the ticket. Takes exactly the same arguments
127 as the comment method above.
128
129 attachments
130 Get attachments associated with this ticket. What is returned is an
131 object of type RT::Client::REST::SearchResult which can then be used
132 to get at objects of type RT::Client::REST::Attachment.
133
134 transactions
135 Get transactions associated with this ticket. Optionally, you can
136 specify exactly what types of transactions you want listed, for
137 example:
138
139 my $result = $ticket->transactions(type => [qw(Comment Correspond)]);
140
141 Please reference RT::Client::REST documentation for the full list of
142 valid transaction types.
143
144 Return value is an object of type RT::Client::REST::SearchResult
145 which can then be used to iterate over transaction objects
146 (RT::Client::REST::Transaction).
147
148 take
149 Take this ticket. If you already the owner of this ticket,
150 "RT::Client::REST::Object::NoopOperationException" will be thrown.
151
152 untake
153 Untake this ticket. If Nobody is already the owner of this ticket,
154 "RT::Client::REST::Object::NoopOperationException" will be thrown.
155
156 steal
157 Steal this ticket. If you already the owner of this ticket,
158 "RT::Client::REST::Object::NoopOperationException" will be thrown.
159
161 This class inherits 'cf' method from RT::Client::REST::Object. To
162 create a ticket with a bunch of custom fields, use the following
163 approach:
164
165 RT::Client::REST::Ticket->new(
166 rt => $rt,
167 # blah blah
168 cf => {
169 'field one' => $value1,
170 'field two' => $another_value,
171 },
172 )->store;
173
174 Some more examples:
175
176 # Update a custom field value:
177 $ticket->cf('field one' => $value1);
178 $ticket->store;
179
180 # Get a custom field value:
181 my $another value = $ticket->cf('field two');
182
183 # Get a list of ticket's custom field names:
184 my @custom_fields = $ticket->cf;
185
187 rt_type
188 Returns 'ticket'.
189
191 RT::Client::REST, RT::Client::REST::Object,
192 RT::Client::REST::Attachment, RT::Client::REST::SearchResult,
193 RT::Client::REST::Transaction.
194
196 Dmitri Tikhonov <dtikhonov@yahoo.com>
197
199 Perl license with the exception of RT::Client::REST, which is GPLed.
200
201
202
203perl v5.12.0 2008-08-16 RT::Client::REST::Ticket(3)