Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-78520

Executing a search request on the /rest/api/2/user/search endpoint with startAt and maxResults parameters has a result of returning a maximum of 100 users and failing to paginate beyond the first 100 users

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Low Low
    • None
    • 10.0.0, 10.3.0, 10.3.5, 10.4.0
    • REST API

      Issue Summary

      In versions of Jira prior to 10.0, the /rest/api/2/user/search endpoint supported fetching up to 1000 users per request and allowed proper pagination through the startAt parameter. However, in Jira 10.x, the following regressions have been observed:

      This is reproducible on Data Center: Yes

      Steps to Reproduce

      1. Ensure more than 100 users exist in Jira.
      2. Execute the following REST API calls:
      • Call 1:
        https://{baseurl}/rest/api/2/user/search?username=.&startAt=0&maxResults=100
        
        • Expected: Returns 100 users.
        • Actual: Returns 100 users. (Expected behavior)
      • Call 2:
        https://{baseurl}/rest/api/2/user/search?username=.&startAt=0&maxResults=110
        
        • Expected: Returns 110 users.
        • Actual: Returns only 100 users.
      • Call 3:
        https://{baseurl}/rest/api/2/user/search?username=.&startAt=100&maxResults=50
        
        • Expected: Returns users 101–150.
        • Actual: Returns no results or incorrect results.

      Expected Results

      The /rest/api/2/user/search endpoint should:

      • Support retrieving more than 100 users per request when maxResults is set higher than 100 (e.g., 110).
      • Allow proper pagination using the startAt parameter to fetch subsequent batches of users.
      • Return users starting from the specified startAt index when combined with maxResults.

      Actual Results

      The /rest/api/2/user/search endpoint:

      • Limits results to a maximum of 100 users, regardless of the maxResults parameter value.
      • Does not properly handle the startAt parameter for pagination, returning either no results or incorrect results beyond the first 100 users.

      Workaround

      1. Use Username Filters to Fetch Subsets of Users
        By applying filters to the username parameter, you can retrieve smaller subsets of users and manually aggregate the results. For example:
        https://{baseurl}/rest/api/2/user/search?username=a*&startAt=0&maxResults=100
        
      2. Query the Jira Database Directly
        If direct access to the Jira database is available, the customer can query the cwd_user table to retrieve all users. Example query:
        SELECT user_name, display_name, email_address
        FROM cwd_user
        WHERE active = 1
        ORDER BY user_name ASC
        LIMIT 100 OFFSET 0;
        

              eaec06bb454d Andrzej Kotas
              ce77d5847fbf Deniz Secilir (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              28 Start watching this issue

                Created:
                Updated:
                Resolved: