Mailing List Archive

API call to get "Created" value of history replies of all tickets
Dear Request Tracker Developers,

The following issue has been raised in rt-users list, however there was
no response. If there is no currently available solution, it would be
nice to have it implemented in the future release of RT, for example, a
support of an API query that returns all tickets and all histories at
once. Please see the details below.

We are using RT 4.2.12 through API to allow the communication between
the users of our deposition system and the reviewers of those
depositions. We have a single RT user which is used by our deposition
system to create and manage tickets for all depositors. Each deposition
has an ID associated with it and this ID is stored as a custom field for
each ticket. We have a page that displays the list of all depositions.
If there is a new message available, then a notification is displayed
near the deposition in this list. Whether the message is new or not is
determined based on the "Created" value of the last reply to the ticket.
This value is compared with the corresponding value in the database and
each time the ticket history is opened through our deposition system the
database's value is updated.

The problem lies in getting the "Created" value of the last reply for
each deposition. This is done through a query
/REST/1.0/ticket/<ticket-id>/history?format=l

However, since this has to be done for all the depositions' unresolved
tickets, the loading of the page with the deposition list can take a
long time (each API call is about 200 ms or more). Please could you tell
if there is a query available to get the history for all the tickets in
the queue in one go? We can then parse the result to obtain the
necessary last reply times. Or is there a better way available to see
the time of the last reply to the ticket, the email and whether it is a
comment or not?

Many thanks and best regards,
Andrii
---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016
Re: API call to get "Created" value of history replies of all tickets [ In reply to ]
On Mon, 25 Jul 2016 16:51:17 +0100
Andrii Iudin <andrii@ebi.ac.uk> wrote:
> However, since this has to be done for all the depositions' unresolved
> tickets, the loading of the page with the deposition list can take a
> long time (each API call is about 200 ms or more). Please could you tell
> if there is a query available to get the history for all the tickets in
> the queue in one go? We can then parse the result to obtain the
> necessary last reply times. Or is there a better way available to see
> the time of the last reply to the ticket, the email and whether it is a
> comment or not?

The time of last reply to the requestor is stored in the "Told"
field. If you need more than that, you'll need to denormalize the
information by putting it into custom fields (updated via scrips), which
you can then query all at once using the /REST/1.0/search/ticket
endpoint and setting your "fields" to contain those CFs.

Alternately, you could write your own endpoint entirely. That may also
still require denormalizing the data, as walking the transaction
history is unlikely to be performant, no matter how you slice it.
- Alex
---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016
Re: API call to get "Created" value of history replies of all tickets [ In reply to ]
Dear Alex,

Many thanks for looking into this request and suggesting several
solutions! It looks to me that "Told" field should do it, if not - we
will try the rest of your suggestions.

Best regards,
Andrii

On 26/07/2016 07:45, Alex Vandiver wrote:
> On Mon, 25 Jul 2016 16:51:17 +0100
> Andrii Iudin <andrii@ebi.ac.uk> wrote:
>> However, since this has to be done for all the depositions' unresolved
>> tickets, the loading of the page with the deposition list can take a
>> long time (each API call is about 200 ms or more). Please could you tell
>> if there is a query available to get the history for all the tickets in
>> the queue in one go? We can then parse the result to obtain the
>> necessary last reply times. Or is there a better way available to see
>> the time of the last reply to the ticket, the email and whether it is a
>> comment or not?
> The time of last reply to the requestor is stored in the "Told"
> field. If you need more than that, you'll need to denormalize the
> information by putting it into custom fields (updated via scrips), which
> you can then query all at once using the /REST/1.0/search/ticket
> endpoint and setting your "fields" to contain those CFs.
>
> Alternately, you could write your own endpoint entirely. That may also
> still require denormalizing the data, as walking the transaction
> history is unlikely to be performant, no matter how you slice it.
> - Alex
> ---------
> RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
> * Los Angeles - September, 2016

---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016
Re: API call to get "Created" value of history replies of all tickets [ In reply to ]
Dear Alex,

Please could you tell if "Told" is updated only when the reply is sent
from an RT user? Is it possible to set it up to be updated even for
replies from external sources, e.g. when the requestor sends the reply?

Best regards,
Andrii


On 26/07/2016 10:24, Andrii Iudin wrote:
> Dear Alex,
>
> Many thanks for looking into this request and suggesting several
> solutions! It looks to me that "Told" field should do it, if not - we
> will try the rest of your suggestions.
>
> Best regards,
> Andrii
>
> On 26/07/2016 07:45, Alex Vandiver wrote:
>> On Mon, 25 Jul 2016 16:51:17 +0100
>> Andrii Iudin <andrii@ebi.ac.uk> wrote:
>>> However, since this has to be done for all the depositions' unresolved
>>> tickets, the loading of the page with the deposition list can take a
>>> long time (each API call is about 200 ms or more). Please could you
>>> tell
>>> if there is a query available to get the history for all the tickets in
>>> the queue in one go? We can then parse the result to obtain the
>>> necessary last reply times. Or is there a better way available to see
>>> the time of the last reply to the ticket, the email and whether it is a
>>> comment or not?
>> The time of last reply to the requestor is stored in the "Told"
>> field. If you need more than that, you'll need to denormalize the
>> information by putting it into custom fields (updated via scrips), which
>> you can then query all at once using the /REST/1.0/search/ticket
>> endpoint and setting your "fields" to contain those CFs.
>>
>> Alternately, you could write your own endpoint entirely. That may also
>> still require denormalizing the data, as walking the transaction
>> history is unlikely to be performant, no matter how you slice it.
>> - Alex
>> ---------
>> RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
>> * Los Angeles - September, 2016
>

---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016
Re: API call to get "Created" value of history replies of all tickets [ In reply to ]
On Fri, 29 Jul 2016 13:42:37 +0100
Andrii Iudin <andrii@ebi.ac.uk> wrote:
> Please could you tell if "Told" is updated only when the reply is sent
> from an RT user? Is it possible to set it up to be updated even for
> replies from external sources, e.g. when the requestor sends the reply?

"Told" is updated on correspondence which is not from a requestor, when
at least one requestor isn't squelched. Note that this means it is
updated even if no Notify scripts send email.

If you want some other formulation, you can use a scrip to call
->SetTold().

- Alex

---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016
Re: API call to get "Created" value of history replies of all tickets [ In reply to ]
Dear Alex,

Thank you for clarifying this.

Best regards,
Andrii

On 29/07/2016 23:14, Alex Vandiver wrote:
> On Fri, 29 Jul 2016 13:42:37 +0100
> Andrii Iudin <andrii@ebi.ac.uk> wrote:
>> Please could you tell if "Told" is updated only when the reply is sent
>> from an RT user? Is it possible to set it up to be updated even for
>> replies from external sources, e.g. when the requestor sends the reply?
> "Told" is updated on correspondence which is not from a requestor, when
> at least one requestor isn't squelched. Note that this means it is
> updated even if no Notify scripts send email.
>
> If you want some other formulation, you can use a scrip to call
> ->SetTold().
>
> - Alex
>

---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016