2
votes

I just upgraded our Nexus repository from OSS 2.14.5-02 to OSS 3.6.2-01. I set the legacy url to true (like described in http://books.sonatype.com/nexus-book/3.1/reference/install.html#config-legacy-url), but it seems that the REST API is not backward compatible.

For example, the following REST API works on my old Nexus server (it downloads the jar): http://old_url:8081/nexus/service/local/artifact/maven/content?r=releases&g=my_group_id&e=jar&a=my_artificat_id&v=4.23.9.1

While it doesn't work on the new nexus 3 server (I get Error 404 Not Found): http://new_url:8081/nexus/service/local/artifact/maven/content?r=releases&g=my_group_id&e=jar&a=my_artificat_id&v=4.23.9.1

I didn't find any release notes/documentation about that incompatibility. I have many clients who uses Nexus 2 API and I need to fix it/revert to old Nexus.

2
Having the same issue, seems like api is not usable in new nexus. - user3796774
What exactly is the purpose of the above rest api calls? Apart from that I wouldn't expect that the REST API is compatible to the previous release cause it's major version change...Furthermore haven't you made a test installation before and checked the things you need to have? - khmarbaise
If you wish to revert to the old installation, what problem are you having with that, specifically? - halfer
the rest api we use are for downloading specific artifact/latest. I have many many different clients and the revert is very simple (just changing CNMAE to old machine). I just reverted it, but I still want to get rid of the old nexus server and use the new one (which is now also our npm repository). Changing each client to use the new api is much harder work... - nirs
The NXRM3 REST API is in Beta and does not have 100% parity. I would strongly suggest you ask on the Sonatype user forum (groups.google.com/a/glists.sonatype.com/forum/?hl=en#!forum/…) and see if that's a parity issue or a bug. See here for more about NXRM2 and NXRM3 differences: help.sonatype.com/display/NXRM3/… - joedragons

2 Answers

0
votes

In Nexus2 the /service/local/artifact/maven/content retrieves an artifact: https://repository.sonatype.org/nexus-restlet1x-plugin/default/docs/path__artifact_maven_content.html

You can do the same in Nexus3 with

/content/repositories/yourrepo/groupId/artifactId/version/filename.ext

example:

/content/repositories/myrepo/com/asprint/UtilitiesSDK/1.0/UtilitiesSDK-1.0.jar

This incompatibility of endpoints between Nexus2 and Nexus3 is extremely annoying, and the "Create NXRM2 style URLs Capability" in Nexus3 doesn't seem to cover all cases.

0
votes

The REST API was removed from Sonatype Nexus 3, but since 3.16 a new API has been introduced. It is not backwards compatible, but the /search/assets/download endpoint provides the similar functionality to the Nexus 2 /service/local/artifact/maven/content endpoint.

So

/service/local/artifact/maven/content?r=releases&g=my_group_id&e=jar&a=my_artificat_id&v=4.23.9.1

becomes

/service/rest/v1/search/assets/download?repository=releases&maven.groupId=my_group_id&maven.extension=jar&maven.artifactId=my_artificat_id&maven.baseVersion=4.23.9.1

Announcement: https://community.sonatype.com/t/nxrm-3-16-rest-search-and-filtering-enhancements/1586

Documentation: https://help.sonatype.com/repomanager3/rest-and-integration-api

You can find Swagger API documentation in your Sonatype nexus 3 administration menu, under 'API'. Note that it seems to be incomplete, for example maven.extension is not documented as a parameter there (at the time of writing this answer).