Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-74331

The REST API endpoints to get all users are not returning the email address field

XMLWordPrintable

      Issue Summary

      The REST API endpoints to get all users (below) are not returning the emailAddress field:

       At the same time the Get user endpoint (GET /rest/api/3/user/search), to only get active users, returns the email address or not depending on the users' Profile Visibility Settings (like the rest of the user related REST API endpoints).

      Therefore, either we make this behavior consistent or we explicitly document this behavior and we motivate it. 

      Steps to Reproduce

      1. Call the Get user endpoint like, for example:
        https://<NAME>.atlassian.net/rest/api/3/user/search?query=&maxResults=1000 
      2. See that, among the other things, the email address field is returned: 
        ...
        "self": "https://<NAME>.atlassian.net/rest/api/3/user?accountId=XXXXXXXXXXXXX",
         "accountId": "XXXXXXXXXXXXXXXXXXXX",
         "accountType": "atlassian",
         "emailAddress": "XXXXXXXXXX@atlassian.com",
        ...
      3. Now call the Get all users default, for example: 
        https://<NAME>.atlassian.net/rest/api/3/users

      Expected Results

      The behavior is consistent with the one of the  Get user endpoint.

      Actual Results

      The emailAddress field is not returned at all:

          ...
          "self": "https://<NAME>.atlassian.net/rest/api/3/user?accountId=XXXXXXXXXXXXX",
          "accountId": "XXXXXXXXXXXXXXXXXXXX",
          "accountType": "atlassian",
          "avatarUrls": {
      ...

      Notes

      This bug is affected by the email visibility setting on your instance:

      • Jira Settings > System > General Configuration > User email visibility

      If this is set to "Show to logged in users only" (which is the default), then this endpoint does not return the email addresses at all (that's a bug, visible email addresses should be returned)

      However, if you change this setting to "public", then email addresses are returned, but if the person's email visibility is set to "public" then this would cause their email address to be returned even for anonymous requests, which may not be desirable.

      Workaround

      If you want to get the list of all the users (active and inactive) for your instance, including the email address, you can use the Export Users button on the top left of the User Management page for your site:

      This way you can configure what will be included and what not and you will get in return a CSV file including email address, account ID and other useful data that can be easily parsed. 

        1. Export-Users2.jpg
          Export-Users2.jpg
          42 kB
        2. Export-Users.jpg
          Export-Users.jpg
          118 kB

              bkelley@atlassian.com Ben Kelley
              dbonotto Dario B (Inactive)
              Votes:
              5 Vote for this issue
              Watchers:
              14 Start watching this issue

                Created:
                Updated:
                Resolved: