samudhraa
12 years agoExpert
How to filter topics based on highest replies across community ?
I want to create a custom component of Popular Discussion based on the "replies" metric . The topic with highest reply is considered most popular. Is there a REST api or combination of REST calls and filter to implement this?
When you perform a search, you can sort by the number of replies, so search might be a good fit for this. You can use:
- q=is_root:true to give you only topic messages, and
- sort_by=-replies to sort the messages by the number of replies, in descending order
So your REST API call might look like:
/restapi/vc/search/messages?q=is_root:true&sort_by=-replies
For example:
http://lithosphere.lithium.com/restapi/vc/search/messages?q=is_root:true&sort_by=-replies
I hope this helps!