REST API endpoint to export all users to CSV

XMLWordPrintable

    • 148
    • 51

      Summary

      As an administrator I would like to have a REST API endpoint that I can call in order to export users to CSV. The same CSV export you can get from the instance user management when you click on 'export all users' documented in the below page:

      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. You may find a sample Python script in this link.

      There is an updated Python script provided by the DEV team as the endpoint API is no longer valid link here

      It is also possible to get the same information via the Organizations Rest API, but it is more complex to do so and will require significantly more than 1 call:

      1. Get Users In An Organisation - Returns users in your organisation, along with details about these users
      2. User’s last active dates - Returns the last time a user accessed each app in your organisation
      3. Get Groups in an organisation - If you pass in the account id of a specific user as a value in AccountIDs, this will return all groups that user is a member of
        To get the information for 1000 users, this approach would require a minimum of 2010 calls, 10 for step 1, and then 1000 each for steps 2 and 3
         

              Assignee:
              Stefan Scorse
              Reporter:
              Dario B
              Votes:
              209 Vote for this issue
              Watchers:
              134 Start watching this issue

                Created:
                Updated: