Can I query all boards within a workspace?

Hi!

What is the best way to retrieve all boards within a workspace? When querying for boards one cannot filter on workspace, and the Workspace type does not list the boards it contains.

Any idea?
Thanks!

Hey @zweitze :wave:

That’s a great question! As you can not query a workspace directly, I would suggest querying for the workspace ID in your boards query, and then filtering in your application instead. For example:

The Main Workspace will always have an ID of null, so you can assume that the board belongs to the main workspace in those cases. Do you think this could work for you?

-Alex

Thanks for confirming this solution!

My use-case is requesting all items in a workspace - regardless their board. In that scenario the proposed solution wouldn’t work, with other boards I get too many items and I run into rate limits etc… I guess I have to use multiple requests.

1 Like

@zweitze

Thank you for circling back with me!

In general, one of the main principles of using GraphQL is “Ask for only what you need”, so I guess using multiple light-weight requests might be a much leaner approach in terms of your complexity usage. Perhaps it might make sense to query boards for their ID and their workspace ID, and then query the items of those boards, rather than trying to query all items?

Thank you for sharing your use case though - I’ll be sure to add that on to the feature request :slight_smile:

-Alex

@Alex,

I’m just trying to reduce the number of roundtrips to the API server - but in this case it will be like your suggestion.

In case you’re interested, I found something weird with workspaces: with the API you can add new workspaces, remove workspaces, but not query existing workspaces. You can only query the workspace of a board, so there’s no way to detect workspaces without boards.
This does not affect my use-case now, I just thought I’d share this finding.

1 Like

@zweitze

Thank you for flagging this! I agree that this can be somewhat limiting, and I also think it would be great to have an option to query workspaces directly, instead of querying their info as part of boards. I’ll pass your feedback on this as well, as it would be a great improvement.

I appreciate your help in making our API better :slight_smile:

-Alex

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.