Excluding sub-item boards when querying boards

Hello,

I’ve seen a lot of posts about querying and locating sub-items on a board. However, I’ve not seen any questions on how to filter out or exclude sub-item boards from appearing in my query results of boards. Does anyone have any advice on how to exclude those boards from my query?

The following simple query returns a sub-item list/board, which is not a board I care about from a global view perspective.

{“query”:"{boards(limit:1,state:active){name state board_folder_id board_kind columns{id title type} description groups{id title color} }}"}

Return the following (some details filtered)

Array
(
    [data] => Array
        (
            [boards] => Array
                (
                    [0] => Array
                        (
                            [id] => ######
                            [name] => Subitems of To Do - Department
                            [state] => active
                            [board_folder_id] =>
                            [board_kind] => public
                            [columns] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => name
                                            [title] => Name
                                            [type] => name
                                        )

                                    [1] => Array
                                        (
                                            [id] => person
                                            [title] => Owner
                                            [type] => multiple-person
                                        )

                                    [2] => Array
                                        (
                                            [id] => status
                                            [title] => Status
                                            [type] => color
                                        )

                                    [3] => Array
                                        (
                                            [id] => date0
                                            [title] => Date
                                            [type] => date
                                        )

                                )

                            [description] =>
                            [groups] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => topics
                                            [title] => Subitems
                                            [color] => #579bfc
                                        )

                                )

                        )

                )

        )

    [account_id] => ####
)

Hey @LucidHeart,

Thanks for reaching out! That’s a great question.

To be transparent with you, it is not possible to filter out sub-item boards at this time. You will always get all of the boards that your User Profile has access to within your account when querying boards. As an alternative, I can recommend adding “parent_item” to the query. If you get a result in the parent_item field, that means you’ve got a Sub-item board in your query, and you could exclude that.

It might not be an ideal solution, but this could do the trick for you in the meantime. What do you think?

You can find more info on the parent_item field here:

Subitems - API Docs

-Alex