Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,464,696
Community Members
 
Community Events
176
Community Groups

Export users from User Management API or Programatically

Hello ,

 

Is there any way to export users (https://support.atlassian.com/security-and-access-policies/docs/export-users-from-a-site/) programmatically via API or any other way

 

 

Thanks

1 answer

0 votes
Darryl Lee Community Leader May 12, 2022

Hi!

I tried Bob Swift's CLI command getUserList, then compared the output to the Export from the Admin interface, and alas, it misses a lot. (API calls the CLI uses are down at the end of this answer.)

acli jira -a getUserList --outputFormat 999 --file cliusers.csv

The resulting CSV only contains these columns:

User Key Name Email Time Zone Avatar URL Active Groups Account Type
Darryl Lee 12345:12ab3c45 Darryl Lee darryl.lee@myemail.com America/Los_Angeles https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:55df3d50-d179-4d17-b747-bf1484246c4f/76f52fda-5bf0-4d68-acb5-c032a63e755a/48 Yes administrators,jira-administrators,jira-developers,shift2,site-admins atlassian

And it only contains ACTIVE or INVITED user accounts, whereas the export from the Admin interface includes SUSPENDED accounts. Additionally the CSV has many many more columns, and optionally creates a row for each Group/User, allowing for easier group sorting.

Group id Group name User id User name email User status Added to org Org role Last seen in Jira Service Management - boomaster Last seen in Jira Software - boomaster Last seen in Confluence - boomaster Last seen in Team Central - boomaster Last seen in Statuspage - boomaster Jira Service Management - boomaster Jira Software - boomaster Confluence - boomaster Team Central - boomaster Statuspage - boomaster
123456-b2b1-xxxx-1234-xxxxxxx jira-servicemanagement-users 12345678ec1234567a0fd743 fb-jiratest3 fb-jiratest3@darryl.com Suspended 17-Nov-21 None Never accessed Never accessed Never accessed Never accessed Never accessed User User None None None

So, it kind of depends on what you need.

I used the --verbose flag on getUserList and was able to see the API commands that CLI uses. Basically it's getting a list of users, then iterating through each one to get their group memberships:

https://YOURHOST.atlassian.net/rest/api/latest/users?maxResults=1000&startAt=1000
https://YOURHOST.atlassian.net/rest/api/latest/user?accountId=user1id&expand=groups%2CapplicationRoles
https://YOURHOST.atlassian.net/rest/api/latest/user?accountId=user2id&expand=groups%2CapplicationRoles
https://YOURHOST.atlassian.net/rest/api/latest/user?accountId=user3id&expand=groups%2CapplicationRoles

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events