How do I get the "export users from site" csv through the API?

Austin Yu September 5, 2019

Through other posts I've found that I can use the API and hit something like https://servername/rest/api/2/user/search?username=a to get all users. However, this doesn't seem to match the CSV file I can get if I manually export users through admin.atlassian.com (documentation for this -> https://confluence.atlassian.com/cloud/export-users-from-a-site-833925313.html).

How do I get that same list through the API since it shows whether the user has access to Jira Software, Jira Core, and Confluence?

1 answer

1 accepted

1 vote
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 9, 2019

Hi @Austin Yu ,

Welcome to the Atlassian Community! 

As announced in the Say goodbye to usernames in Atlassian Cloud documentation page, we removed the username field from user profiles in Atlassian Cloud sites in order to improve users' privacy and comply to GDPR.

This has also impacted the endpoint you are using and you can find detailed information about the changes in the below links:

 

Now, if you are trying to get the list of users having access to a particular product using REST API in Cloud, you may want to use the Jira Core REST API endpoint  /rest/api/<VERSION>/group/member passing as the argument the name of the group that gives access to the desired product. For example, if you want to get the list of all the users having Confluence product access, you can call:

https://XXXXXX.atlassian.net/rest/api/3/group/member?groupname=confluence-users

 

If you are trying to achieve something different instead, please provide as many details as possible.

 

Cheers,
Dario

Austin Yu September 9, 2019

Hi Dario,

Thanks for the response!

Sorry for the confusion I don't necessarily need the username specifically. I'm really just looking to get that same csv file that is provided when I click on export users in the Atlassian Cloud user management page with 'all users' selected for the user status option and 'product access' selected in the additional data section, but through an API call. 

Is this possible? and if so, how would that be done?

Thank you

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2019

Hi @Austin Yu ,

This is not possible at the moment, therefore I have created the below feature request on your behalf to ask to have this functionality implemented:

 

As I have written in there, there is a "dirty" workaround that can be used in the meanwhile, however please notice that this is not officially supported and it may change in the future:

Workaround

It is possible to grab the cookie from an active site-admin session from the browser and then use it to authenticate a REST API POST request sent to the below internal endpoint (replace <CLOUD-ID> with your real cloud instance id):

https://admin.atlassian.com/gateway/api/adminhub/um/site/<CLOUD-ID>/users/export

As the body you can send something like:

{
includeApplicationAccess: true
includeGroups: false
includeInactiveUsers: true
selectedGroupIds: []
}

Please notice this is just a workaround, the endpoint is not official, not documented and may change over time.

 

 

Let me know if this helps.

 

Cheers,
Dario

Austin Yu September 13, 2019

Hi @Dario B ,

Thanks for creating that request for me and for the workaround. This definitely helps and I'll use that for now!

Like Dario B likes this
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 17, 2019

You are very welcome @Austin Yu !

Please accept the answer or, if you don't mind, I will do it tomorrow since you confirmed this can work for the time being :) 

Cheers,
Dario

Like Austin Yu likes this

Suggest an answer

Log in or Sign up to answer