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.1st. Create a blobstore. This is the blobstore that we will be associating with our new repo.
Curl:
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”:
ii) Post this as a script to NXRM:
iii) Run this script on NXRM to create the repo:
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.
Curl:
4th. Create User. In this step we will assign this user the ny-dev-role we created in step 1.
Curl:
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.