Forum Discussion

ghayman's avatar
ghayman
Guide
12 years ago

Recent category threads

Hi all

 

I can see how to return all recent threads:

  <#assign threads = rest("/threads/recent").threads />

 

and I can see how to return recent threads for the current board :
  <#assign threads = rest("/boards/id/" + coreNode.id + "/threads/recent").threads />


 

but I cannot see how to return recent threads for the current category (group of boards). One might think:

  <#assign threads = rest("/categories/id/" + coreNode.id + "/threads/recent").threads />

 

but that method doesn't exist. What am I missing?

 

Thanks

Geoff

 

  • Just as a quick follow up for other users. It turned out what I really needed was recent topics.

     

    /topics/recent

    /categories/id/" + coreNode.id + "/topics/recent

    /boards/id/" + coreNode.id + "/topics/recent

     

    For each message in the topic list I was able to get to the thread info I needed.

     

    Hope this helps someone :smileyhappy:

     

    Geoff

     

  • DavidE's avatar
    DavidE
    Lithium Alumni (Retired)

    Hello ghayman,

     

    You are correct. That rest call does not exist in our API. For categories, you can only request threads by "featured" and "style".

     

    Your question presents an interesting problem, since recent threads are stored at board level this would not scale well as the size of the community grows. The tree structure of a community has the potential to grow exponentially. Hence we do not currently have this rest call supported.

     

    However, this can be done programatically using "categories/id/<id>/boards/nested" to get a list of the boards under the category. With this list of boards, recent threads could be requested from each board. After sorting the recent threads, you could take the top x threads as recent for the category.

     

    Note that the community does support "threads/featured/nested" for all of the featured articles under the category.

     

    Let me know if you have any other questions or if this is a feature request and I will answer it as soon as I can or direct the question to the proper employees in Lithium.

     

    Sorry I could not be of more help, but thanks for your question,

     

    David

    • ghayman's avatar
      ghayman
      Guide

      Just as a quick follow up for other users. It turned out what I really needed was recent topics.

       

      /topics/recent

      /categories/id/" + coreNode.id + "/topics/recent

      /boards/id/" + coreNode.id + "/topics/recent

       

      For each message in the topic list I was able to get to the thread info I needed.

       

      Hope this helps someone :smileyhappy:

       

      Geoff

       

    • ghayman's avatar
      ghayman
      Guide
      Thanks David - I just wanted to be sure I wasn't missing anything.