REST and Integration API
The REST API can be used to integrate the repository manager with external systems. Nexus Repository leverages Open API to document the REST API. To make it easier to consume, we ship Nexus Repository with Swagger UI - a simple, interactive user interface, where parameters can be filled out and REST calls made directly through the UI to see the results in the browser. This interface is available under the API item via the System sub menu of the Administration menu and requires nx-settings-read privilege to access it. NOTE: The nx-settings privileges give access to multiple views. There is no setting to view only the API at this time. Also, when viewing the API all APIs and their examples and models are shown, however, only the APIs that the user has permission to utilize will function.
For those who wish to work with the API outside of Nexus Repository, we serve an Open API Document at
<nexus_url>/service/rest/swagger.json which always represents the API available on running instance and does not require any privilege to access it. This document can be imported into Postman to work with it interactively, Swagger Codegen to generate a programmatic client, or other tools compatible with Open API Specification.
For older versions of Nexus Repository (3.3.0 through 3.6.0), you can access Swagger UI at
A comprehensive listing of REST API endpoints and functionality is documented through the UI as stated above and to a lesser extent in subpages shown below.
Note about /beta endpoints
APIs with /beta endpoints are fully supported by Sonatype, will not be removed and are safe to use in production systems. Compatible newer versions may have aliases allowing newer functionality without any change.
Topics in this section:
- Assets API
- Blob Store API
- Components API
- Email API
- IQ Server API
- Licensing API
- Lifecycle API
- Maintenance API
- Nodes API
- Read-Only API
- Repositories API
- Search API
- Security Management API
- Script API
- Status API
- Support API
- Tasks API
Disabled Groovy Scripting By Default
In order to make Nexus Repository more secure, we have disabled Groovy scripting engine by default. This affects Groovy scripts as used through the REST API and through scheduled tasks.
For more information (including how to re-enable Groovy scripting), see NEXUS-23205.
Nexus Repository 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. Nexus Repository 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. For more about tasks see this documentation section.
- A script may be uploaded and run through the REST Script API.
Nexus Repository 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.