Forum Discussion

bryanpollack's avatar
11 years ago

Filter topics by board_id

I'm using the /topics/style/board/recent call to create a list of recent topic posts. Is there any way to exclude certain board_ids from the list retrieved? Or maybe to specify which board_ids I want included? Thanks.

4 Replies

  • HaidongG's avatar
    HaidongG
    Lithium Alumni (Retired)
    11 years ago

    Hi Bryan,

     

    As I know /topics/style/board/recent may not provide the board inclusion or exclusion feature. you may consider to user /search api 

     

     

    for example, in your example, 

     

    /search/messages?include_forums=true&sort_by=-date&collapse_discussion=true&board_ids=pmA,tcB

     

    1. include_forums=true means to get messages under boards only, no TKB, no idea
    2. sort_by=-date means to get messages in desc order
    3. collapse_discussion=ture means to get topics only, no need to include replies
    4. boards_id means a comma separated list of boards

     

    I hope that my answer helps. 

     

     

    btw: if you worried about the user right, if user has no access to board X and board Y, no post from those boards will be shown with your REST API calls (no matter /recent or /search) with freemarker "rest("/......")"

  • This doesn't seem to return any messages unless I set a search field and a search term... am I doing something wrong?
  • samudhraa's avatar
    samudhraa
    Expert
    11 years ago

    Hi bryanpollack ,

     

    I have added q=is_root , which gives me only the root message. Can you give this a try ?

    /search/messages?q=is_root&include_forums=true&sort_by=-date&collapse_discussion=true&board_ids=sample1,sample2

     

    Hope this helps.

     

    Thanks,

    Sam