3

We are working on a Node and Angular 5 project in which we are using Nexus as a repository of our application. This application is transpiled, packaged and uploaded to the Nexus repository. Then we have created a pipe in Jenkins that downloads the latest version of the application from Nexus and executes it. But now we are having a problem. There is no call to the Nexus API to return the path to the latest version of a node package (generated by npm publish).

The call we are making is the following:

http://HOST-NEXUS/service/rest/v1/search?repository=my-repository&name=my-node-project

But it has a problem: this call only returns the first 50 versions. If you already have more than 50 versions of the application in the repository, it does not return the last ones.

So I was wondering would you know any way to extend this limit of 50 versions? Or better yet, do you know how to get the latest version directly? Something like this (this example doesn't work in Node, but it does work in Maven):

http://HOST-NEXUS/service/rest/v1/search?repository=my-repository&name=my-node-project&version=LATEST

Thanks and best regards.

Jose Sabater
  • 83
  • 4
  • 13
  • 1
    What version of NXRM is this for? Support for latest was added in 3.16. – joedragons May 30 '19 at 18:02
  • The version is 3.14, do I have to update it necessarily? Thanks – Jose Sabater Jun 04 '19 at 07:53
  • On the other hand, where could I see an example of a call to the Nexus API that returns the latest version of a Node package? Thanks – Jose Sabater Jun 04 '19 at 08:47
  • In my answer, I provided a link to the JIRA ticket where people suffered on older versions for a while; you may be able to find a workaround there. I also provided a link to the release post where there is an example for maven, but I suspect it'll be similar (repository, component, sort order). – joedragons Jun 04 '19 at 22:46

2 Answers2

0

Support for "latest" download via REST was added to NXRM3 in version 3.16.0. See the JIRA ticket for more information.

An example of provided on the release blog but probably will depend on your repository, format and what you're trying to fetch. There is also a Swagger UI provided for REST in NXRM3 that can be used to form your own statements. It can be accessed in the administration section under System -> API. Sonatype's REST documentation may also help.

joedragons
  • 2,505
  • 21
  • 21
  • 1
    Thank you very much, I have updated Nexus to version 3.16 and it already returns the list of the last 50 packages (not the first ones). A greeting. – Jose Sabater Jun 06 '19 at 13:27
0

Api document: {nexus_url}/service/rest/swagger.json

GET {nexus_url}/service/rest/v1/search?name=project-name&sort=version