Bulk update Atlassian teams memberships for Atlassian Cloud using Postman and REST APIs
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
When to use this article
This article may be used any time there is a need to bulk update and add team memberships in Atlassian Cloud.
Identify your organisation’s user management
Head to admin.atlassian.com. Select your organization if you have more than one.
Original | Centralized |
As a site administrator or organization admin, Users is found under Product site. | As an organization admin, Users is found under Directory tab. |
Prepare data
Original data
Sample file
A | B | |
---|---|---|
1 | Team | |
2 | vdillow@banc.ly | Transformers |
3 | ftoten2@banc.ly | Platform CORE |
4 | amelmeth@banc.ly | Pipedream |
Get user identifiers
- Go to admin.atlassian.com. Select your organization if you have more than one.
This step is different depending on your user management experience:
- Original: Select the site's name and URL to open the Admin for that site, then select Users.
- Centralized: Select Directory > Users.This step is different depending on your user management experience:
- Original: Select Export users.
- Centralized: At the top of the screen, select > Export users.Select the users that you’d like to export:
All users in your site/organization – Include all users in your site/organization, across all groups.
Users from selected groups only – Only includes users in the groups you select.
Select "All users" to include all active, suspended and deactivated users.
- Select Export users.
- An email will be sent when the CSV file is ready to download. Check your junk or spam folder if it’s taking awhile.
- Open the email and select Download CSV file.
- Rename the file to
users.csv
. - Using a spreadsheet program, remove columns D onwards. This leaves a csv file with only three columns.
- Save the csv.
Sample file - users.csv
A | B | C | |
---|---|---|---|
1 | User id | User name | email |
2 | 6155833c071axxx071ff5b24 | Janaye Float | jfloat@banc.ly |
3 | 7a4b625f3fd5xxx24d741ac7 | Anissa Melmeth | amelmeth@banc.ly |
4 | e2345d51eaa4xxx984e377ce | Verna Dillow | vdillow@banc.ly |
5 | 3c5e0172a629xxx061259ed9 | Dorice Snapper | dsnapper@banc.ly |
6 | 982bfd68520fxxx71daccb32 | Florian Toten | ftoten2@banc.ly |
Get team identifiers
There is currently no systematic way to retrieve team names and id's while - ID-8562Getting issue details... STATUS is not developed. It is also noted that team names are not unique.
- Using a spreadsheet program, create a spreadsheet with two columns.
- Label the columns
teamId
andteamName
. - Navigate to your Jira or Confluence site.
- In the top navigation bar, click Teams > Search People and Teams.
- In the search field labelled "Search for people and teams", search for a team where you need to identify the id.
- Select the team.
- Observe the URL - https://bancly.atlassian.net/wiki/people/team/d9ecb30d-f441-4731-b5ca-805fd35b153c
- The final GUID in the path represents the team id. In this case, it would be
d9ecb30d-f441-4731-b5ca-805fd35b153c
. - Copy this value into the corresponding teamId for the row.
- Repeat the above steps for each team in question.
- Save the file as
teams.csv
.
Sample file - teams.csv
A | B | |
---|---|---|
1 | teamId | teamName |
2 | 58fe54f2-33fc-47a5-8c05-b662fcdc64b8 | Pipedream |
3 | c3abf5af-7fff-4268-ad9c-b74109c21a2a | Platform CORE |
4 | eb47fb27-ad5c-441c-b753-c45b789b9229 | Transformers |
Map data
- Open the original list of groups and users in a spreadsheet program.
- Into a new tab, import the previously created
users.csv
. This assumes the tab is now called "users". - Into a new tab, import the previously created
teams.csv
. This assumes the tab is now called "teams". - Open the spreadsheet tab containing the original list.
Ensure columns A and B have the desired user email address and group name respectively.
- In cell C1, label the column header
accountId
, noting the case is important. In cell C2, type:
=XLOOKUP($A2,users!$C$2:$C$1000,users!$A$2:$A$1000,"")
Ensure that A2:C1000 in the sheet
users
covers all users. This assumes column A contains the "Account id" and column C contains "email address" inusers
. The value of "1000" may need to be increased.- Fill the remaining cells with an equivalent formula, ensuring $A2 is updated to the corresponding cell in the same row, but the remaining arguments remain the same.
- Perform a random check to ensure the lookup is behaving as expected.
- In cell D1, label the column header
teamId
, noting the case is important. In cell D2, type:
=XLOOKUP($B2,teams!$B$2:$B$1000,teams!$A$2:$A$1000,"")
Ensure that A2:C1000 in the sheet
groups
covers all groups. This assumes column A contains the "Team id" and column B contains "Team name" inteams
. The value of "1000" may need to be increased.- Fill the remaining cells with an equivalent formula, ensuring $A2 is updated to the corresponding cell in the same row, but the remaining arguments remain the same.
- Perform a random check to ensure the lookup is behaving as expected.
- The resulting list should now be supplemented with account id's and team id's, and contain four columns.
- Save the resulting list as a csv.
Sample file
A | B | C | D | |
---|---|---|---|---|
1 | Team | accountId | teamId | |
2 | vdillow@banc.ly | Transformers | e2345d51eaa4xxx984e377ce | eb47fb27-ad5c-441c-b753-c45b789b9229 |
3 | ftoten2@banc.ly | Platform CORE | 982bfd68520fxxx71daccb32 | c3abf5af-7fff-4268-ad9c-b74109c21a2a |
4 | amelmeth@banc.ly | Pipedream | 7a4b625f3fd5xxx24d741ac7 | 58fe54f2-33fc-47a5-8c05-b662fcdc64b8 |
Set up Postman
This section may be skipped if:
a collection named "Atlassian Cloud User Management" has previously been set up, and
an environment named "Atlassian Cloud" has previously been set up
Find organization id
- Navigate to admin.atlassian.com.
- Select your organization if you have more than one.
- Observe your organization id from the URL:
https://admin.atlassian.com/o//overview
where the org id is a GUID, for example:
7d737580-498a-1b1c-kcd1-kdjj1d0bada9
Set up REST API call
Click New, or type
Ctrl
+N
(Windows/Linux) orCmd
+N
(MacOS).Select "HTTP".
Name the request "Add User to Team in Atlassian Cloud".
Change the method from
GET
toPOST
.In the URL, paste:
{{cloudUrl}}/gateway/api/public/teams/v1/org/<orgId>/teams/{{teamId}}/members/add
Note that Postman variables are case-sensitive and must match what is supplied in the attached environment and spreadsheet.
- Replace
<orgId>
in the URL with the organization id previously obtained. - Click the "Authorization" tab.
Ensure Type is "Inherit auth from parent".
- Click the "Body" tab.
- Select content type "raw".
In the content space for Body, paste:
{ "members": [ { "accountId": "{{accountId}}" } ] }
Note that Postman variables are case-sensitive and must match what is supplied in the attached spreadsheet.
Click Save, saving into the "Atlassian Cloud User Management" collection.
Execute Postman Runner
Change the environment using the environment selector at the top right of Postman, selecting "Atlassian Cloud".
Select Collections in the sidebar.
Select the "Atlassian Cloud User Management" collection.
On the Overview tab, select ▶️ Run towards the top right corner.
Under Run order, ensure there is one and only REST API call - "Add User to Team in Atlassian Cloud".
On the Functional tab, select Run manually.
Click Data.
Navigate to and select the previously prepared csv file from "Map data".
Reduce the number of "Iterations" under Run configuration to 1.
Leave Advanced settings as is.
Click Run Atlassian Cloud User Management.
Check Postman to ensure the runner collection has passed all tests. The run results should show:
"Iterations" and "All tests" to be equivalent in count
Passed (n) where n is the number of iterations
Failed (0)
Skipped (0)
Check admin.atlassian.com to ensure the user in row 2 of the exported list has been made a member of the expected group.
Rerun Postman Runner following the previous steps, with the number of "Iterations" set to the number of rows in the csv file.
Troubleshooting
Error | Comments |
---|---|
401 | Check your credentials. |
404 |
|
References
- Export users from a site
- Microsoft - Import or export text (.txt or .csv) files
- developer.atlassian.com - Teams Public REST API
- Postman - Using the Collection Runner