NXRM 3.16 REST search and filtering enhancements


#1

For our DevOps, CD, and Deployment teams, we’ve seriously improved search capabilities for the latest version of components! As you may know, there are 3 REST endpoints in NXRM 3 that are used for searching:

  • (serverUrl)/service/rest/v1/search - search for components
  • (serverUrl)/service/rest/v1/search/assets - search for assets
  • (serverUrl)/service/rest/v1/search/assets/download - search for an asset and download it

As of 3.16, each of these endpoints support a few new query parameters:

  • sort - this query parameter will define how to sort the search results. As an added bonus, for the search-and-download endpoint, this removes the requirement that only 1 result is returned in the search, simply letting you download the first result. If this parameter is omitted the default relevance sorting will be used. The following fields can be sorted on:

    • group
    • name
    • version
    • repository
  • direction - the order to sort the results in; this field is ignored if the sort field is not also supplied. The direction can either be ‘asc’ (ascending) or ‘desc’ (descending). If this field is omitted, default direction of ‘asc’ will be used, unless sorting on version then ‘desc’ will be used.

  • prerelease - a flag stating whether to include prelease assets in the response. If set to ‘true’ only prerelease results will be returned. If set to ‘false’ only release results will be returned. If this field is omitted, the default behavior of returning both release and prerelease results will be used.

    • Note that currently only the maven/npm/yum formats properly populate this ‘prerelease’ field in the search index, other formats have all assets marked as ‘release’.

When these query parameters are combined, they give the ability to download the latest release version of an asset, which has been something often requested in NXRM 3. Downloading the latest junit for example:

http://localhost:8081/service/rest/v1/search/assets/download?repository=maven-central&group=junit&name=junit&maven.classifier=& sort =version& prerelease =false


Nexus Repository Manager 3.16.0 release announcement