Forum Discussion

bnlucas's avatar
bnlucas
Adept
9 years ago

REST API - Find all forums and boards under category

 I'm trying to build an outline of our categories and the forums and boards associated with them. I have been searching the documentation for about an hour and I cannot figure out how to find forums linked to a category.

 

 

<ul>
<#list rest("/categories?restapi.response_style=view").categories.category as category>
    <li>${category.title}</li>
    <ul>

        <!-- Find all forums/boards linked to category -->

    </li>
</ul>

I've been able to find the boards linked

 

SELECT * FROM boards WHERE parent_category.id = '<ID>'

But I can't find the forums at all.

  • bnlucas - By forums, what did you mean? These are generally referred to as boards which you have already found. Are you looking for any specific type of information?

     

    Lithium has following:

     

    Categories

    Boards (forums) 

    Threads/ Messages

    Blogs

    Ideas

    TKB

    Contest

    QandA

    Groups

  • Within the UI, I have a category with four children. Three of which are designated as "forums" when you hover over the icon and the other is designated as a "board." When I run that LiQL that I posted, it is only returning the one designated as a board, not the three forums as well.

    I believe I figured it out using ancestor_id over parent_id.
    • cike's avatar
      cike
      Champion

      Hi bnlucas,

       

      within the Lithium universe forum and board are synonyms, but the common wording for this kind of node is board. Technically, the conversation.style of messages from a board is set to "forum".

       

      What's the difference between you forums and boards? Which node type did you choose when creating the elements?

       

      Best regards,

      Christian

      • bnlucas's avatar
        bnlucas
        Adept

        cike - I wasn't the one who set up the boards, so I'm not exactly sure. I have fully figured it out though, something I couldn't find in the documentation anywhere. The LiQL didn't work, it only returns the "board"

         

        Using the following, I'm able to get the information:

         

        <ul>
        <#list rest("/categories?restapi.response_style=view").categories.category as category>
            <li>${category.title}</li>
            <ul>
                <#list rest("/categories/id/${category.id}/boards?restapi.response_style=view").boards.board as board>
                <li>${board.title}</li>
            </#list>
            </ul>
        </#list>
        </ul>

        I found this looking at:

         

        SELECT boards FROM categories

        Which gives:

        SELECT * FROM boards WHERE ancestor_categories.id = '<ID>'