Getting teams a user belongs to

I have a question regarding getting user information using the GraphQL API. According the API I can get for every user many information fields.
For instance, when running the following code:

{
  users {
    id
    name
    email
    title
    created_at
    photo_small
  }
}

I can get the name, email, title, date when the item was created, and a link to a small profile picture version for the different users.

However I would like also retrieve the different teams every user belongs to by running the following code:

{
  users {
    id
    name
    email
    title
    created_at
    photo_small
    teams {
      ids
    }
  }
}

I get the following error:

{
  "errors": [
    {
      "message": "Field 'ids' doesn't exist on type 'Team'",
      "locations": [
        {
          "line": 10,
          "column": 7
        }
      ],
      "fields": [
        "query",
        "users",
        "teams",
        "ids"
      ]
    }
  ],
  "account_id": 12801323
}

I also modified the code by inserting the teams ids as numbers, but then I get problems for putting wrong datatypes (Int) in the query.

According the documentation, the teams that a user belongs to can be retrieved by using the argument teams, when query the user’s information. However until now, I haven’t found yet the right way to set my query so I can get this information. Does anyone have the solution to it?

Kind Regards.

hi @rogeralmengor

When used as a field name it is called id (not ids). When using to restrict which teams oy want to see, you can use (ids:{xxx, yyy]). This one should work:

{
  users {
    id
    name
    teams {
      id
      name
    }
  }
}