When you use Nexus, it is more than a UI. It is a collection of services available for you to automate. With these services you can integrate Nexus in whatever workflow makes sense for you. As a developer, this is what I look for in a product: something beyond the UI, something I can automate, and, most importantly, something that is documented. In Nexus, we’ve made it easy to start integrating Nexus REST services into your workflow by providing extensive documentation.
Yesterday’s post was all about automating Nexus with REST services, and today’s post is focused on giving you the tools you need to access the hundreds of REST endpoints you have access to with Nexus. If you are trying to automate anything in Nexus, you should know that there are two ways to “read” the Nexus REST API. You can access plugin documentation via the Nexus UI, or you can use a tool like Firebug in Firefox or Chrome’s Developer Tools and inspect the requests generated by the Nexus UI.
Reading the Nexus REST Documentation
While Nexus has a rich set of hundreds of REST endpoints for everything from core actions like storing artifacts in a repository to professional features like procurement and staging, the documentation is little tough to find. Here are the steps you need to take to access this documentation:
- Login as an Administrator
- In the Administration section of the left-hand menu, click on Plugin Console to open the Plugin Console.
- Once in the Plugin Console you will see a list of Nexus Plugins. Click on a plugin to view the APIs it provides.
- Once you select a plugin, you should see a list of APIs. For example, the video below shows the Core API, click on the link in the Plugin Console to view the REST API documentation.
Here’s a video walkthrough that shows you how to get to the Nexus REST documentation:
The REST API documentation is extensive and detailed, but there are often times when the best documentation for the Nexus REST API is Nexus itself. In these cases, fire up one of several modern browsers and just watch the network traffic…
Learning the Nexus API by Example
For us the REST API isn’t just an extra feature that is “nice” to have, the Nexus UI is based on this REST API. Consider it solid and tested, we rely on it as much as you will come to rely on it. Everything you do in the Nexus UI is calling back to this API. This is why the best way to figure out how to interact with the Nexus REST API is often just fire up a tool like Chrome and watch what the UI is sending across the wire back to Nexus.
Here’s a video that demonstrates how to use Chrome to spy on Nexus. This is often the fastest way to figure what your automation scripts need to do to automate common Nexus tasks: