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