Forum Discussion

janh's avatar
janh
Mentor
12 years ago

Rest API call issues for Labels in Forums

Hi Lithium Support,

 

I'm currently working on customized page to show forum threads filtered by a Label but I've come across a strange issue that the call returns the full list of threads in a topic regardless of what label text is passed. Take for example a Rest Call made to this Lithosphere topic:

 

http://lithosphere.lithium.com/restapi/vc/boards/id/lisupport/threads/for/labels/text/nonexistantlabel/recent/

 

Which returns the same threads if I use the following call:

 

http://lithosphere.lithium.com/restapi/vc/boards/id/lisupport/threads/for/labels/text/recent/

 

Whereas similar API calls for category of type Blogs and Ideas work ok. For example:

 

http://lithosphere.lithium.com/restapi/vc/boards/id/scienceofsocial/threads/for/labels/text/Engagement/recent

 

Returns at least 3 threads

 

http://lithosphere.lithium.com/restapi/vc/boards/id/scienceofsocial/threads/for/labels/text/nonexistantlabel/recent/count

 

As expected, this doesn't return any threads.

 

Is there a special REST parameter that Forums require to be filtered by a Label?

 

 

 

 

  • You are correct, there is a bug with filtering forum threads based on labels. This is due to a lot of special handling of search based legacy code. 

     

    However, are you sure that you need the entire thread? It sounds like you are making a list of the topics (root messages) with specific labels. If this is the case, you can filter boards/topics on labels (notice the filters in the blue box at the top).

     

    Let me know if you need a list which includes the entire thread instead of just a list of root messages and we will continue to look for another way.

8 Replies

  • That's funny I've got a very similar problem just now...For me it works perfectly if a bord is a tkb, but not for a forum.

    I will look deeper into that tomorrow...I'm tired.

  • DavidE's avatar
    DavidE
    Lithium Alumni (Retired)
    12 years ago

    Thanks for asking. I will take a look at this a little later today. Let us know if anything changes.

  • DavidE's avatar
    DavidE
    Lithium Alumni (Retired)
    12 years ago

    You are correct, there is a bug with filtering forum threads based on labels. This is due to a lot of special handling of search based legacy code. 

     

    However, are you sure that you need the entire thread? It sounds like you are making a list of the topics (root messages) with specific labels. If this is the case, you can filter boards/topics on labels (notice the filters in the blue box at the top).

     

    Let me know if you need a list which includes the entire thread instead of just a list of root messages and we will continue to look for another way.

  • niten's avatar
    niten
    Guide
    12 years ago

    I've got the same problem here and it's still not working for me. It's really confusing...and hard to explain but I will try.

     

    To simplify, I've got a categorie. Whithin this categorie I get all the labels with :

    server_url/restapi/vc/categories/id/${cat.id}/labels/labels?restapi.response_style=view

     

    Unitil there no problem, I've got 3 labels.

    Then I want to get the threads for those labels by board

     


    For this I use 

    server_url/restapi/vc/boards/id/${myBoardId}/threads/for/labels/id/${label.id}/recent/

     

    And there is the problem.I checked with count, and if 'myBoardId' is a tkb, I've got the good count for any label ID. But if 'myBoardId' is a forum I always get 1 when I should have 1, 0 and 0. And it's always the same board wich is return no matter the label ID. How can the same board be return for 3 differents label ?

     

    I can't figure out the problem.I'm not sur if I'm missing something or if it's just a bug.

     

    Can someone help me on this ?

     

     

     

  • janh's avatar
    janh
    Mentor
    12 years ago

    Have you tried using the topics argument instead of threads, like so? 

     

    server_url/restapi/vc/boards/id/${myBoardId}/topics/for/labels/id/${label.id}/recent/

     

  • niten's avatar
    niten
    Guide
    12 years ago

    Wow, it works with topics.

    I don't understand why it's not with threads, is that a bad practice to use it ?

     

    Anyway, thanks a lot !

     

    niten