Skip to content
Sample scripts that use NXRM's scripting interface
HTML Groovy CSS Other
Branch: master
Clone or download


Integration API Scripting Examples

Example projects for the Integration API as documented in

See what other interesting scripts have been created at

Getting Started

Look at the examples in these projects to get more familiar with how to load, run, and write your own scripts to run inside of Nexus Repository Manager.

Step 1 - simple-shell-example

simple JSON script files and shell scripts for interaction with the REST API

Step 2 - nexus-script-example

Maven project for script development with IntelliJ IDEA-supported code completion

Step 3 - complex-script

complex provisioning setup based on a shell script invoking numerous groovy scripts for upload and execution

Passing Parameters

When running the script, the body of the POST request will be passed to your groovy in the args field. You can treat this as a normal string, use Groovy’s JsonSlurper to parse it as JSON, or read in any other groovy way.

The echo.json sample shows this in action. To test it out:

  1. First, cut and paste the contents of echo.json into the body field in the Nexus API UI for adding a new script and give your script a name, and click the "execute" button to submit the POST /v1/script request to save the script in your instance of Nexus Repository Manager

  2. Next, using the name from Step 1, execute the POST /v1/script/{name}/run request with any text you choose in the body.

  3. Notice that the response for Step 2 will return the text that you passed in!

For a more interesting example, see addRole.groovy and the corresponding documentation at the bottom of This script allows you to create your own custom REST API that enables you automate the creation of new Roles inside of Nexus Repository Manager.

API Reference

There are 4 officially supported API interfaces:

  1. Core

  2. BlobStore

  3. Repository

  4. Security

To learn more about the methods in each interface, use code complete in your favorite IDE with the nexus-script-example project, or take a look at the Javadoc index.html

You can’t perform that action at this time.