Resources Blog Four Steps to Get Started with Nexus Repository Using New ...

Four Steps to Get Started with Nexus Repository Using New REST APIs

Nexus Repository Manager (NXRM) has new supported REST API endpoints that can automate your binary management needs. REST APIs allow clients to interact with an application, providing them with the capabilities of retrieving and transforming application data. NXRM endpoints make it possible to automate and seamlessly integrate with your tools and CI/CD pipeline.

A number of programming languages can be used to interact with NXRM. In the examples below we will be using the command line tool cURL in addition to the Groovy programming language . In this tutorial we will show you how to quickly get setup with NXRM by using its API endpoints to create a user, a repo, and user permissions.

Create a Blobstore

1st. Create a blobstore. This is the blobstore that we will be associating with our new repo.


Create a Repository

2nd. We will need to create our repository and we will be using Groovy to accomplish this.

i) Create JSON file mavenScript.json. Here we are creating a script called “mavenRepo” which will create a hosted repository titled “ny-maven-internal”:

Post Script to NXRM

ii) Post this as a script to NXRM:

Run the Script on NXRM

iii) Run this script on NXRM to create the repo:

Create a Role

3rd. We need to create a role so that this can later be assigned to our new user. This role grants read and write permissions on repo ny-maven-internal.


Create a User

4th. Create User. In this step we will assign this user the ny-dev-role we created in step 1.


That’s it! In four steps you have created a user that has read/write access to their team’s new repository.

You can view the full list of supported APIs in the UI or in our documentation here. For additional scripts you may find our community GitHub repo a fun place to stop by and say hello.

Picture of Sable Yemane

Written by Sable Yemane

Sable Yemane is a Sales Engineer at Sonatype focused on providing DevSecOps solutions to enterprises