How to Fetch Site-scoped Atlassian Teams via Public Teams REST API
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Atlassian Teams details were not returned when fetched via the Teams Public APIs.
Environment
Site-scoped Atlassian Teams.
Diagnosis
Empty data returned when querying site-scoped teams with the Get a list of teams endpoint. A sample request and its correlating response are as follows:
- Request:
curl --request GET \ --url 'https://api.atlassian.com/public/teams/v1/org/{orgId}/teams' \ --header 'Accept: application/json' \ --user {email}:{apiToken}
- Response:
{ "entities": [], "cursor": "{cursorUuid}" }
Cause
Atlassian Teams reside on the organisation level by default. However, they can also be pinned to sites (site-scoped), so they won't be shared across all sites under the organisation. Hence, such teams won't be returned via the Teams Public APIs if their correlating siteIDs
parameter are not specified.
Solution
Depending on the endpoint, the siteId
parameter may need to be included in the request URL when fetching site-scoped teams. Please see the Teams Public APIs documentation for more details.
A sample request is as follows:
curl --request GET \
--url 'https://api.atlassian.com/public/teams/v1/org/{orgId}/teams?siteId={siteId}' \
--header 'Accept: application/json' \
--user {email}:{apiToken}