Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonatype Nexus 3 REST API backward compatibility

Tags:

rest

maven

nexus

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.

like image 353
nirs Avatar asked Jan 18 '26 19:01

nirs


1 Answers

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).

like image 165
Bertware Avatar answered Jan 21 '26 08:01

Bertware