how to list all teams using rest api

Tushar Wagh March 28, 2023

how to list all teams using rest api

1 answer

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2023

Hi @Tushar Wagh - poking around on my Teams page, I think you need to use the GraphQL API.

Oh right, here's an announcment:

On my account, I see a POST to this endpoint:

https://MYSITE.atlassian.net/gateway/api/directory/graphql?q=TeamMembership
With this payload:
{
  "query": "query TeamMembership($teamId: String!, $membershipState: [TeamMembershipStatus], $enableV3: Boolean) {\n    TeamMembership: TeamMembership(teamId: $teamId, membershipStates: $membershipState, enableV3: $enableV3) {\n      user: profile {\n        id,\n        fullName,\n        title,\n        avatarUrl,\n        timezone,\n        status\n      },\n      state:membershipStatus,\n      role,\n      membershipId {\n        teamId, memberId\n      }\n    }\n  }",
  "variables": {
    "teamId": "399368c8-c7cc-4d48-bc05-17e05a192f61",
    "membershipState": [
      "FULL_MEMBER",
      "INVITED"
    ],
    "enableV3": true
  }
}
And the response was a nice big blob of JSON that included the queried attributes for the three team members I just added.
Now do I understand how any of that works? Ha, nope! But I think the main thing is that's my teamId, same as show in the URL for my team:
https://MYSITE.atlassian.net/jira/people/team/399368c8-c7cc-4d48-bc05-17e05a192f61
I think you could use the teamSearch query to lookup the ID for a team?
So yeah, I don't actually have any experience with GraphQL, but hopefully this is enough to get you started.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events