REST and Integration API
Available in Nexus Repository OSS and Nexus Repository Pro
Nexus Repository Manager leverages a simple UI interface to generate the comprehensive REST documentation from the available endpoints. The REST API can be used to integrate the repository manager with external systems. The interface is fully interactive, where parameters can be filled out and REST calls made directly through the UI to see the results in the browser.
As of NXRM 3.6.1, this interface is available under the API item via the System sub menu of the Administration menu.
For older versions of NXRM (3.3.0 through 3.6.0), use the following:
A comprehensive listing of REST API endpoints and functionality is documented through the UI. The following highlights noteworthy functionality:
- Search - component search functionality
- Assets - direct access the assets/binaries and associated metadata in a repository
- Components - direct access to language native logical grouping of files in a repository, e.g., maven2 groupId, artifactId, version
- Script - for provisioning and other complex tasks
- Tasks - available administrative tasks for the repository manager
Topics in this section:
- Assets API
- Components API
- Lifecycle API
- Maintenance API
- Nodes API
- Read-Only API
- Repositories API
- Script API
- Search API
- Status API
- Support API
- Tasks API
Nexus Repository Manager also provides a scripting API. Scripts can be written to perform custom tasks that can't be handled directly through the UI or the REST API. NXRM scripts are written in the Groovy programming language. More information about Groovy can be found at http://groovy-lang.org/.
There are several methods to run scripts, including:
- To run a script from the Nexus Repository UI, you must create a scheduled task. Navigate to Tasks from the Administration menu, and create a task of type Admin - Execute script. Enter the script source into the Source form field. Set the task frequency to Manual (or another setting to execute on a schedule) and save. The script can then be executed by selecting it from the list of tasks and pressing the Run button.
- A script may be uploaded and run through the REST Script API
Nexus provides the following APIs to scripts:
- Core API: allows a script to set global configuration options
- Security API: allows a script to add users, roles, and privileges
- Blob Store API: allows a script to create new blob stores
- Repository API: provides a simple, format-specific interface for creating repositories
Sample scripts and javadoc API documentation can be found at https://github.com/sonatype-nexus-community/nexus-scripting-examples.
For recommendations on configuring a stable scripting environment and tips from Sonatype, see this knowledge base article.