Advanced Use Cases for the Nexus Repository Manager API

One of the most frequent area of questions related to Nexus Repository Manager is how to integrate with other tools via the API.

Integrations API

Nexus Repository Manager 2 only contained a formal REST API. This required complex administrative tasks to be performed using multiple HTTP calls, sometimes resulting in race conditions. We solved this with Nexus Repository Manager 3 by creating a flexible Integrations API that allows administrators to combine multiple configuration tasks into one HTTP call. The new API also provides the flexibility to perform complex use cases that are not possible with an object based REST API. Sample groovy scripts and the Javadocs for the Integrations API can be found in our GitHub project at GitHub - sonatype-nexus-community/nexus-scripting-examples: Sample scripts that use NXRM's scripting interface. The full documentation for each can be found at REST and Integration API.

REST API

Nexus Repository Manager 3 does have a more traditional-style REST API. Whereas the Integrations API is focused on configuration automation, the REST API is focused on searching and interacting with the content of the repositories. An introduction to the REST API can be found at Nexus Repository: New Beta REST API for Content. As of 3.6.1, the Administration section of Nexus Repository Manager UI includes a link to the REST API documentation right in the left-nav.

More Examples

We are continuing to expand our examples and usability of the APIs. We’d love to hear what use cases you have solved using the APIs. Please Reply as a Linked Topic to share your solutions!

1 Like

It’s also worth taking a look at this article, it shows how to set up Eclipse or IntelliJ for Integrations API development:

That will allow for code completion, which makes writing scripts much easier.

Also take a look here if you’re going to be writing scripts that use database transactions:

3 Likes