Forum Discussion

matthieul's avatar
6 years ago

[REST API] Can't find a way to sort groups by creation_time

Hi y'all,

I hope you will be able to help as I'm out of ideas ðŸ™‚

I'm simply trying to sort my group lists by creation_date, but I can't seem to find a way to make it works.

My actual code is:

 

<#assign groups = rest("/groups/list") />

<#list groups.group as group>
    <#assign groupUrl = restadmin("/groups/id/${group.id}/web_page_url").string/>
<a href="${groupUrl}">Click me</a>
</list>

 


I have massively simplified the code above so it is comprehensible, so please try not to suggest modification or work around for this part, this is here as an example.

Here is what I tried so far :

  • I tried to add a "sort_by" or "sort" in the REST url without success.
  • I have tried to add a "?sort_by"  when I assign my groups list.

 

<#assign groups = rest("/groups/list") />
<#assign groups = groups?sort_by("creation_time") />

 

  • I have tried to find with the Liql editor in the admin interface the groups column so I can change my REST request by an SQL one to add a order_by, but my SELECT * FROM groups gives me a  "Invalid query syntax"

I hope I am clear enough. What can I do to achieve this "simple" task that is to sort my groups to display them by creation_date time.

Thans a lot !

  • matthieul 

    Currently the list of groups in the context of the node sorted by member count only. 

    I will let you know,if I found something for you.