Forum Discussion

Dromanchik's avatar
12 years ago

REST API: how to get community threads sorted by latest post date?

Hi guys,

 

How can I get community threads (or topics) sorted by most recent posts (with each thread appearing only once)?

I have tried

/restapi/vc/threads/recent?topic_sort_order=last_post_date

/restapi/vc/topics/streams/key/by-latest-post/after

It doesn't works.


Can you help me with it?


Thanks.

 

  • Hey,

    The /restapi/vc/threads/recent call by itself should return a list of the recent threads  sorted by the post date of the thread topic, descending. You should not require any extra sorting.

    Hope this helps. Let me know if you want to get some different result.

    Thanks,
    Chhama

    • ChhamaJ. Thanks for the answer.

      But I still want to get "community threads sorted by most recent posts".
      I need the threads to be sorted by message post date (or reply, or comment) rather than topic post date.

      • ChhamaJ's avatar
        ChhamaJ
        Khoros Staff

        Try this

         

        /restapi/vc/boards/id/[board-id]/threads/top

         

        This should work. Let me know if this is not what you want.

         

        Thanks,
        Chhama

  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)

    There is also the option of using the steams API with the "by-latest-post" key.  However, using this does involve a Lithium controlled configuration to even be available.  If you want to use streams, contact support.