Available in Nexus Repository OSS and Nexus Repository Pro
This is a powerful scripting API that provides methods to simplify provisioning and executing other complex tasks in the repository manager. These APIs can be invoked from scripts that are published to the repository manager and executed within the application server.
More detailed documentation is available in the following topics:
This endpoint allows us to create a utility script within the repository manager.
As an example, let's create a simple script that simply logs "Hello, World!":
The JSON document we send includes the unique name of the script, the contents of the script itself, and the language type of the script (in this case groovy).
This endpoint allows us to get a listing of all the scripts currently defined in the repository manager.
Building on the example from above, we only have the one script that we just created:
This endpoint allows us to get the details for an individual script by its name.
Let's get the details for the helloWorld script that we defined earlier:
This endpoint allows us to update the contents of an existing script.
Let's update our script to log "Hello, Nexus!" instead of "Hello, World!":
This endpoint allows us to run a script that we have already defined in the repository manager.
Let's run our helloWorld script:
The JSON response tells us which script ran and the returned result from the script:
We should also see something like the following in the console log:
This enpoint allows us to delete scripts once they are no longer needed.
Let's delete our helloWorld script:
A successfull deletion returns no content: