cancel
Showing results for 
Search instead for 
Did you mean: 

Groups API

steven_okennedy
Star Contributor
Star Contributor
Hi,

Just seeing some funny behaviour when calling the groups API.  I'm just calling the webscript /api/groups but I'm seeing varying behaviour with the results being returned when limiting the number of results to show.

I've set up about 25 local groups for test purposes called G1, G2, G3… etc and if I call the api sorting by displayName, without limiting the number of results, it all works as expected, so calling


http://localhost:8080/alfresco/service/api/groups?sortBy=displayName


and I get back the standard Alfresco groups (ALFRESCO_ADMINISTRATORS, ALFRESCO_MODEL_ADMINISTRATORS, ….) followed by my test groups (G1, G10, G11…) in lexigraphical order, so all as expected.

However, if I add in a maxItems parameter, things stop behaving themselves.  If I run


http://localhost:8080/alfresco/service/api/groups?sortBy=displayName&maxItems=1


I would expect to get ALFRESCO_ADMINISTRATORS back, but it appears that the API is limiting the results before applying the sort and what I get is the group G1.  If I increase the number of items that can be returned, the behaviour continues the same way until I get beyond the number of groups that I've created e.g.


http://localhost:8080/alfresco/service/api/groups?sortBy=displayName&maxItems=26


Then the results I get look like (ALFRESCO_ADMINISTRATORS, G1, G10, G11, G12, G13…).

Can anyone comment if this is expected behaviour?  And if it is then what it is the point of the sort feature of the API at all?

Thanks

Steven
1 REPLY 1

steven_okennedy
Star Contributor
Star Contributor
I guess I'll raise a JIRA on this then