Nodes API
Note
Only available in Sonatype Nexus Repository Pro. Interested in a free trial? Start here.
Introduction
These endpoints allow us to get information about the nodes in the current cluster and update the friendly names of individual nodes. The list of nodes returned is a view of the state of the system and cannot be edited through this API. From this API, nodes can be assigned friendly names, but that is currently the only editable attribute. The friendly names may provide a more convenient mechanism to identify individual nodes for administrative activities.
Endpoints
Get Nodes
GET /service/rest/v1/nodes
This endpoint gives us a listing of the nodes currently in the cluster.
curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/nodes
The information returned includes a unique nodeIdentity
for each node along with the current socket address binding and the current friendly name of the node:
[ { "nodeIdentity" : "20550283-C2239399-2DC0307C-DE78EE76-0670E0BC", "socketAddress" : "/172.18.0.2:5701", "friendlyName" : null }, { "nodeIdentity" : "2840754A-E8053498-0DA01A51-9A7582DD-A52D5279", "socketAddress" : "/172.18.0.3:5701", "friendlyName" : null }, { "nodeIdentity" : "A54F51B3-F0EBD6F7-23D4C3A0-ABA922CD-9DCE73EA", "socketAddress" : "/172.18.0.4:5701", "friendlyName" : null } ]
Update Nodes
PUT /service/rest/v1/nodes
This endpoint allows us to update friendly names for nodes in the cluster:
curl -u admin:admin123 -X PUT --header 'Content-Type: application/json' \ http://localhost:8081/service/rest/v1/nodes \ -d '{"nodeIdentity" : "20550283-C2239399-2DC0307C-DE78EE76-0670E0BC","socketAddress" : "/172.18.0.2:5701","friendlyName" : "node1"}'
If successful, this operation returns the updated information for the node:
{ "nodeIdentity" : "20550283-C2239399-2DC0307C-DE78EE76-0670E0BC", "socketAddress" : "/172.18.0.2:5701", "friendlyName" : "node1" }