How to query team on board with API?

Hello,

We want to retrieve the list of teams subscribed to a board with the type “subscriber” or “owner” as for the user. We can see that it’s possible to add a team to a board with th add-teams-to-a-board mutation. However we can’t retrieve the teams of board on the query boards fields Boards dispate of the api playgraound auto-complete suggests a “team_owners” parameter which return nothing.

Does it possible or that is a current limit of the api ?

Hello there @CedricMourizard and welcome to the community!

I hope you like it here :muscle:

You can query for the teams and users that are subscribed to a board with a query like this one:

{
  boards(ids: 1234567890) {
    owners {
      name
      id
      teams {
        name
        users {
          id
          name
        }
      }
    }
    subscribers {
      name
      id
      teams {
        name
        users {
          id
          name
        }
        id
      }
    }
  }
}

Is that what you needed?

Cheers,
Matias

1 Like

Hello Mathias

Thanks for your try ! However this request gives the teams of the owners and the subscribers of the board but not the teams directly added on the board.

Hello again @CedricMourizard what do you mean when you say directly added?

If you add a team as subscriber to a board like this:

And then use this query on that board:

{
  boards(ids: 1234567890) {
    subscribers {
      name
      id
      teams {
        name
        users {
          id
          name
        }
        id
      }
    }
  }
}

You will get the information about the team added to the board.

If instead of that, what you want is to check the teams that are assigned to a people column in a board, you can query for the information inside the people column for the items and see the response.

Cheers,
Matias

Hello Matias again,

By your way, we retrieve all the teams of the subscribers not the team added on the board. If mathias is not on “Team Two” but he is on “Team One”, the result of the query will return 3 subscribers :

  • mathias with at least “Team One” in his list of teams
  • the 2 members of Team Two with at least “Team Two” in their list of teams but maybe aussi their other teams

We don’t have an API query to retrieve the exact config of board members as the screenshoot you mentionned :

{
  "data": {
    "boards": [
      {
        "id": "1234567",
        "subscribers": [
          {
            "name": "Matias",
            "id": 1099999
          }
        ],
        "owners": [
          {
            "name": "Matias",
            "id": 1099999
          }
        ],
        "team_subscribers": [
          {
            "name": "Team Two",
            "id": 108888
          }
        ],
        "team_owners": []
      }
    ]
  }
}

Hello again @CedricMourizard,

What do you mean when you say “not the team added on the board”?

What do you consider a “team added to the board”? How is the team “added”?

You can see the screen I showed by clicking on the button that says “invite” at the top right corner of the board.

Hello Again,

The team added to the board is in your example “Team Two”

Hello again @CedricMourizard,

The team you see in my screenshot (or as you call it an “added team”) is subscribed to the board. When I add the team via UI, I am subscribing the team. It is the same thing. I think you are just calling it differently.

And this query will get you that team:

{
  boards(ids: 1234567890) {
    subscribers {
      name
      id
      teams {
        name
        users {
          id
          name
        }
        id
      }
    }
  }
}

Cheers,
Matias

1 Like

Hi,
I believe my problem/question is the same as @CedricMourizard so that’s why I am replying here, and I do not think the query that you suggested will retrieve exactly the teams subscribed to the board.

For example, I have two teams (1stTeam and 2ndTeam).

In board members, I have added one of the users of 2ndTeam and the 1stTeam as members.

If I use the query that you specified, I cannot actually distinguish if only a member of X team is part of the board, or the team itself is a member of the board.

This query does not return “teams that are a member of X board” but actually “teams that the subscribers of X board are a part of”.

For example, “2ndTeam” is not a member of this board despite it being part of the response.

A query that directly returns teams that are part of a board and are owners in that board is:
image
But this also is problematic since you cannot retrieve teams that are members in a board, but not owners.