API
Getting Started
NAbox provides several REST endpoints to automate everything you can do in the web interface
There is one endpoint on /api/2.0/
for NAbox confguraton itself, and one on
/havrest/2.0/
to manage ONTAP and StorageGRID systems.
For each of these enpoints, there's a Swagger documentation available on /ui
.
For example, to use the Swagger interface and test APIs for NAbox administration, point your browser
to https://<nabox ip>/api/2.0/ui/
URL.
Likewise, to manage your ONTAP system and browse the APIs for NetApp Harvest, point your browser to https://<nabox ip>/havrest/2.0/ui/
.
Authentication
Authentication for NAbox API is based on standard HTTP authentication mechanism, using the admin
user and password.
For NetApp Harvest API autentication, you need to get obtain a token using basic authentication first.
Testing the API
You can perform a quick test to see if the API is working using curl
on a linux PC for example :
$ curl -u admin:Netapp01 https://<nabox ip>>/api/2.0/system/version
{"version":"v0.7.0-16-g4fdbf64","harvest":"24.03.24","grafana":"10.4.1","prometheus":""}
$ curl -svu admin:Netapp01 https://<nabox ip>/api/2.0/health 2>&1|sed -En 's/.*X-Token-Refresh=([^;]+);.*/\1/p'
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE4OTE3MjUsImlzcyI6Im5hYm94Iiwic3ViIjoiYWRtaW4ifQ.XxexJiSfKbdmCEq3jVW5_dB_VAbB60nCN5y-iSU9Lho
You can then use this token to perform queries on NetApp Harvest :
$ token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE4OTE3MjUsImlzcyI6Im5hYm94Iiwic3ViIjoiYWRtaW4ifQ.XxexJiSfKbdmCEq3jVW5_dB_VAbB60nCN5y-iSU9Lho
$ curl -H "Authorization: Bearer $token" https://<nabox ip>/havrest/api/2.0/systems
{"7-mode":{"addr":"10.1.1.7","datacenter":"LAB","username":"root","use_insecure_tls":true,"systemType":"ONTAP","enabled":true,"running":true},"Webscale Demo":{"addr":"216.240.31.198","datacenter":"LAB","username":"OCI","use_insecure_tls":true,"systemType":"StorageGrid","enabled":true,"running":true},"cluster2":{"addr":"cluster2.home.lab","datacenter":"LAB","username":"admin","systemType":"ONTAP","enabled":true,"running":true}}%