How do I return list of queues in Best practical Request tracker?

2.1k views Asked by At

I need our ticket system Request tracker from Best practical to search for all queues and return list of them. They could change and I do not want to hardcode them in source code or config files.

Is there search query for it?

search/queue?query=...

gives

RT/4.0.7 500 Server Error
Unsupported object type.

Or how can I modify ticket system to return list of all queues?

Ticket system: http://bestpractical.com/rt/

Thanks for suggestions

4

There are 4 answers

0
Kevin F On

REST/1.0/search/queue exists in newer RT releases (4.2.2 and later).

0
lazilyInitialised On

The following links are working in 4.4.0.

  1. Lists all users: /REST/1.0/search/user?query=
  2. Lists all groups: /REST/1.0/search/group?query=
  3. Lists all queues: /REST/1.0/search/queue?query=
0
Houmles On

As others wrote, you can use the RT REST1 API or it's newer version (REST2 API). But it needs some configuration before. Then something like

https://your_rt_server/REST/1.0/search/queue?query=
https://your_rt_server/REST/2.0/queues/all

should work.

Perhaps more straight-forward way is to use the PERL API if you have the access to the filesystem of the RT server. Then it should work like this:

#!/usr/bin/env perl
use lib ("/opt/rt4/lib");
use strict;
use warnings;
use 5.010;

use RT -init;

my $queues = RT::Queues->new($RT::SystemUser);
$queues->UnLimit;
while (my $queue = $queues->Next){
   say $queue->Name;
}
0
Matthew Hanlon On

As far as I know the query you are looking for is not available in the RT REST api. From a similar question on the RT Users list:

RT's REST API is intended mostly for working with tickets (the query is actually TicketSQL as available in the normal Query Builder UI).

If you need to work with and modify other RT objects, you'll want to use RT's perl API.

http://lists.bestpractical.com/pipermail/rt-users/2011-October/073272.html