Utilizing Nutanix REST APIs

  • 28 February 2020
  • 0 replies
  • 658 views

Userlevel 2
Badge +3

Lets say that you want to monitor or modify your cluster by utilizing some of our REST APIs. 

To view Nutanix REST APIs, go to Prism > click on the username on the top right > REST API Explorer. 

Automating the API calls can make your daily tasks easier and faster, it's a script that you write once and you can use it via bots on chat platforms like Slack and Google Hangouts. 

For example, if you have multiple clusters and you wish to see the alerts on all of them, you have the option to automate a script that sends you the alerts by simply writing "<cluster name> alerts" as opposed to logging in to each cluster and inserting the credentials every time. 

Here is my example snippet of a server-side automation with Node.js, the call is to show the alerts on a cluster named Prolix where you can send a basic Auth credentials to pass the login page, the parsed result will be printed in the console.

It’s important to include the first line: 

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; 
This is to pass the first page where it might show that "Your connection is not private" and you will need to click a button to proceed to the cluster's UI. 

Have a question? let me know in the comments.


0 replies

Be the first to reply!

Reply