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

Fetching dashboards using the /rest/api/2/dashboard?maxResults=1000&startAt=0 does not retrieve all dashboards.

    XMLWordPrintable

Details

    Description

      Issue Summary

      When your instance contains over 99 dashboards, the /rest/api/2/dashboard?maxResults=1000&startAt=0 API endpoint fails to exhibit the complete dashboard collection.

      This API endpoint omits one record for every 100 results, leading to an altered display:

      • When querying for 100 dashboards, only 99 will be visible.
      • Querying for 1000 dashboards results in only 990 being displayed.

      Consequently, when dealing with a considerable number of dashboards, a fraction of them may not be retrievable.

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Configure more than 1000 dashboards in your Jira environment.
        • An example script that could be used for this:
          #!/bin/bash
          
          # Set your JSESSIONID and atlassian.xsrf.token values here
          JSESSIONID="retrieve_from_browser_session"
          XSRF_TOKEN="retrieve_from_browser_session"
          
          x=1
          while [ $x -le 3500 ]
          do
            dashboardName="Dashboard_$x"  # Unique dashboard name
            curl 'http://jira.ub2.atl:8080/jira971/secure/AddPortalPage.jspa' \
              -H "Cookie: JSESSIONID=$JSESSIONID; atlassian.xsrf.token=$XSRF_TOKEN" \
              --data-raw "portalPageName=$dashboardName&portalPageDescription=&clonePageId=&favourite=true&projectShare=10000&roleShare=&shareValues=%5B%5D&atl_token=$XSRF_TOKEN&add_submit=Add" \
              --compressed
            x=$((x+1))
          done
          
        • Don't use in production instances!
      2. Retrieve a list of dashboards using REST API endpoint: /rest/api/2/dashboard?maxResults=1000&startAt=0
      3. Store the results in a file, e.g dashboards.json
      4. Count the amount of records retrieved using grep.
        grep -c "\"id\"" dashboards.json
        

      Expected Results

      1000 records will be retrieved.

      Actual Results

      Only 990 records are retrieved.

      Workaround

      Retrieve the dashboards from the database instead.

      select * from portalpage;
      

      Attachments

        Issue Links

          Activity

            People

              szarazinski Sławomir Zaraziński
              sdegroot@atlassian.com Steven de Groot
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: