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
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:
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.
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=1000https://YOURHOST.atlassian.net/rest/api/latest/user?accountId=user1id&expand=groups,applicationRoleshttps://YOURHOST.atlassian.net/rest/api/latest/user?accountId=user2id&expand=groups,applicationRoleshttps://YOURHOST.atlassian.net/rest/api/latest/user?accountId=user3id&expand=groups,applicationRoles
It looks like you're new here. Sign in or register to get started.