[New to GraphQL] Getting all items without sub-items

Hello,

I’m a complete newbie with GraphQL in general, and barely familiar with the monday API and monday boards in general.
I’ve been tasked with extracting the item names using the API, but without the sub-items. By using the query {boards{items{name}}} I’m getting a mixed list of both items and sub-items, all under the key “items”, without any way to distinguish which one is which. Is there a way to filter out sub-items using a simple query?

Thanks for any help! :smile:

P.S. If that’s a common question, please accept my apology, as I don’t even know which keywords to use…

Hey @Polarts ,

welcome to the community!

Your query should actually only return items and no subitems. Maybe the subitems have the same name and your are mistaken them as subitems.

Subitems are basicly column values of an item in the given board. So they are not counted as items, hence they don’t appear in that query.

To visualize what I mean mean here a thread:

Hope that helped you and don’t hesitate to ask.
Always welcome :slight_smile:

Greetings

Thanks for the quick response!

I can confirm that the query {boards{items{name}}} does indeed return collections of subitems. More so, they’re not even categorized by their parent, but rather sent as a mixed collection of all subitems of all items in a group. Unfortunately I can’t share the data here due to company policy.

Anyhow, I’ll try to make the query more specific to just the groups I need. I couldn’t find a way to get the group ID, could you please show me where it is in the app? I activated developer mode but as far as I see it only enabled getting the column ID.

Thanks again!

The query you are using is returning items from every board that you have access to. So, that would include any subitem boards.

It sounds like to are wanting info from one board. Take a look at this:

{ boards(ids: xxxxxxx {items {name group{ title} column_values {id text}}}}

1 Like

The query that worked for me is { boards(ids: [...]) { items { name } } }
Thank you guys so much for the help!

If there’s a way to do the same without selecting specific IDs that would be wonderful. I don’t want to update my code every time a new board is added, but if that’s my only option then it’s fine for now.

Can you give more detail on your use case / what you are trying to accomplish?

Hey @Polarts - glad it’s worked so far! Thank you so much to everyone for helping out :slight_smile:

Could you give us some more detail on what you’re trying to accomplish?