Forum Discussion

samudhraa's avatar
samudhraa
Expert
12 years ago

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...
  • AdamN's avatar
    12 years ago

    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!