REST call to retrieve list of groups

Hi all,
I have found out that I can use this REST call:

http://my.rt.site/REST/1.0/group/<group_name>

to retrieve informations about a group (id, name, description, members).

However, I cannot find a REST way to retrieve the list of groups defined
on an RT instance.
Is it possible?

T.I.A.

Bye
Cris

Hi all,
I have found out that I can use this REST call:

http://my.rt.site/REST/1.0/group/<group_name>

to retrieve informations about a group (id, name, description, members).

However, I cannot find a REST way to retrieve the list of groups defined
on an RT instance.
Is it possible?

RT 4.2.2 adds a search endpoint for users and groups:

    rt ls -t groups
    id: group/1238
    Name: RT hackers
    Description: RT hackers
    Disabled: 0
    
    
    id: group/14255
    Name: BPS Staff
    Description: 
    Disabled: 0
    
    [...]

The endpoint is /REST/1.0/search/groups

  • Alex

Alex Vandiver ha scritto:

RT 4.2.2 adds a search endpoint for users and groups:

     rt ls -t groups
     id: group/1238
     Name: RT hackers
     Description: RT hackers
     Disabled: 0
     
     --
     
     id: group/14255
     Name: BPS Staff
     Description:
     Disabled: 0
     
     [...]

The endpoint is /REST/1.0/search/groups

  • Alex

Alex, this is great news!!

Thank you
Cris

Hi Alex

-----Messaggio originale-----
Da: Alex Vandiver
Inviato: Tue Feb 04 2014 18:46:32 GMT+0100 (CET)
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] REST call to retrieve list of groups

RT 4.2.2 adds a search endpoint for users and groups:

     rt ls -t groups
     id: group/1238
     Name: RT hackers
     Description: RT hackers
     Disabled: 0

     --

     id: group/14255
     Name: BPS Staff
     Description:
     Disabled: 0

     [...]

The endpoint is /REST/1.0/search/groups

  • Alex

Alex, maybe I misunderstood you message.

I have just completed the upgrade to 4.2.2 (from 4.2.1), so I tried
pasting this url in the browser:

http://amended/REST/1.0/search/groups

and this is the reply I got:

no value sent for required parameter ‘query’
Stack:
[/opt/rt4/share/html/REST/1.0/autohandler:54]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:680]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:368]
[/opt/rt4/share/html/autohandler:53]

What am I missing?

T.I.A.

Bye
Cris

I’m sorry to bump this thread, but I never had any feedback, neither
positive nor negative.
Is this something supposed to work in 4.2.2 or not?

Thank you
Bye
Cris

Guadagnino Cristiano ha scritto:

I’m sorry to bump this thread, but I never had any feedback, neither
positive nor negative.
Is this something supposed to work in 4.2.2 or not?

      rt ls -t groups

When someone shows a bin/rt command that works, you can always see
what it is doing by re-running it locally and adding
RTDEBUG=3 to the shell environment (or debug 3 to your rtrc).

The error will become clear once you do that.

-kevin

Hi Kevin

Kevin Falcone ha scritto:> On Tue, Feb 18, 2014 at 02:58:29PM +0000, Guadagnino Cristiano wrote:

I’m sorry to bump this thread, but I never had any feedback, neither
positive nor negative.
Is this something supposed to work in 4.2.2 or not?

       rt ls -t groups

When someone shows a bin/rt command that works, you can always see
what it is doing by re-running it locally and adding
RTDEBUG=3 to the shell environment (or debug 3 to your rtrc).

The error will become clear once you do that.

-kevin

Kevin, thank you for the bit about using RTDEBUG, this is very useful!!

I tried that from the command line and from the output I see it is
POSTing to http://localhost//REST/1.0/search/group. All the groups are
correctly reported.

So it seems my problem was just that I was writing “groups” in stead of
“group” in the URL.
However, when I try this from the browser (Firefox) I still get the same
error as before:

no value sent for required parameter ‘query’
Stack:
[/opt/rt4/share/html/REST/1.0/autohandler:54]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:680]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:368]
[/opt/rt4/share/html/autohandler:53]

There must still be something that’s escaping me.

This could be greatly improved if there was some kind of documentation
on the REST protocol as implemented by RT, besides the largely
incomplete one that is on WIKIA.
Without that, the only way is discovering it by trial and error.

T.I.A.
Cris

However, when I try this from the browser (Firefox) I still get the same
error as before:

no value sent for required parameter ‘query’
Stack:
[/opt/rt4/share/html/REST/1.0/autohandler:54]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:680]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:368]
[/opt/rt4/share/html/autohandler:53]

There must still be something that’s escaping me.

Did you sent a parameter named query?
RTDEBUG probably shows query being sent.

You could argue that groups should act like queues and users when no
query is sent. The best argument is likely a patch.

This could be greatly improved if there was some kind of documentation
on the REST protocol as implemented by RT, besides the largely
incomplete one that is on WIKIA.
Without that, the only way is discovering it by trial and error.

Frankly, I’d rather spend time developing REST/2.0 than further
documenting the flaws in REST 1.0.

-kevin