Forum Discussion

qingliu's avatar
qingliu
Contributor
12 years ago

Using REST API to build a customized featured topic widget

Hi All,

 

I would like to build a customized featured topic widget which will just pull the ehtire categories but not pull the featured blog posts. 

 

I am reading the article in here: http://lithosphere.lithium.com/t5/support-knowledge-base/Using-the-Featured-Topics-feature/ta-p/50772

 

However, the rest CALL return nothing http://forum.kpn.com/restapi/vc/threads/style/board/featured when i tried to use that. 

 

If i give the category ID, it will return the threads which has been featured. 

 

http://forum.kpn.com/restapi/vc/categories/id/KPN_Internet_Bellen_ITV/threads/featured/?page_size=3

 

can you please point out what I have done wrong? 

 

Thank you. 

 

 

Cheers,

Qing

  • Hi Qing,

     

    There are a couple of reasons you're not getting any results. First, the interaction style key you want to use is "forum" instead of "board". Second, the call you're using will only return results from boards directly under the community level, rather than boards in categories. See this note in the documentation for that method:

    "At category or wider scopes, only threads in directly nested boards are included, not those in boards in nested categories."

     

    To get the featured threads for nested categories too, you should use the following method:

    threads/style/[style] /featured/nested

     

    For example: 

    http://forum.kpn.com/restapi/vc/threads/style/forum/featured/nested

     

     

    I hope this helps!

  • AdamN's avatar
    AdamN
    Khoros Oracle

    Hi Qing,

     

    There are a couple of reasons you're not getting any results. First, the interaction style key you want to use is "forum" instead of "board". Second, the call you're using will only return results from boards directly under the community level, rather than boards in categories. See this note in the documentation for that method:

    "At category or wider scopes, only threads in directly nested boards are included, not those in boards in nested categories."

     

    To get the featured threads for nested categories too, you should use the following method:

    threads/style/[style] /featured/nested

     

    For example: 

    http://forum.kpn.com/restapi/vc/threads/style/forum/featured/nested

     

     

    I hope this helps!

    • sdujari's avatar
      sdujari
      Mentor

      Hi AdamN I'm trying to use this to pull featured articles from a TKB. I'm doing the following but it doesn't work:

       

      http://...com/restapi/vc/boards/id/AgileManagerCustomerStories/topics/style/tkb/featured

       

      http://...com/restapi/vc/boards/id/AgileManagerCustomerStories/topics/style/tkb/recent

      does work though but doesn't tell me which topics are featured. Any thoughts?

       

      Is there any way to use /recent to see which topics are featured?

  • I don't think there's a way to get featured threads at a community level (although I could be wrong).

     

    You could retrieve the featured threads from each category and concatenate them (this can be done in FreeMarker or JavaScript).

    • qingliu's avatar
      qingliu
      Contributor

      Hi Nathan,

       

      Thank you.  That means that I will need to have build this widget in two steps. 

       

      1 Step 1:  Using /estapi/vc/categories to get all categories id  . (like i have 6 categories ) 

       

      2. Step2:  Loop through all categories to get featured topic. 

       

      I think that is too much REST calls to achieve that. 

       

      In AllenS post said that: 

       

      In order to do that, I would recommend that you use the following REST calls:

       

      /restapi/vc/threads/style/board/featured

      /restapi/vc/threads/style/blog/featured

       

      These will return the featured threads for boards and blogs respectively. 

       

      But I am not able to get any return by trying these two REST API call

       

      Cheers,
      Qing