Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-21074

Allow to specify the number of items per page when using the REST API

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 3.18.1
    • REST
    • 4

    Description

      When using the Nexus API to get lists of assets and components (or any other endpoint that supports pagination) the result set is limited to 10 items per page.

      https://github.com/sonatype/nexus-public/blob/master/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/rest/internal/resources/AssetsResource.java#L107
      https://github.com/sonatype/nexus-public/blob/master/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/rest/internal/resources/ComponentsResource.java#L140

      This means that when using the Nexus API to query large repos the interaction is rather slow since a new request has to go back and forth for every 10 items queried. If we could customize this value and increase it, I believe this would greatly improve performance.

      The /search resource is limited to 50 items per page:

      https://github.com/sonatype/nexus-public/blob/master/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/rest/internal/resources/SearchResource.java#L104

      Expected

      • expose a parameter+value that the caller can specify on request that can customize the number of top level items to return per page in the response
      • a REST resource that accepts this parameter must also have a documented hard coded maximum value that the passed parameter value will not be able to exceed ( to protect the server from abuse )
      • if the specified value is larger than the hard coded maximum value allowed for that resource, then use the hardcoded maximum value instead of erroring - document this behavior and the maximum value so if the user wonders why they don't get more per page, they can learn why

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              releng-team amp-releng
              Dirk Heinrichs Dirk Heinrichs
              Votes:
              13 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:

                tigCommentSecurity.panel-title