Scroll To Top

Make Changes to Your Nutanix Cluster using PHP and cURL

Posted in Datacenter, Scripting, Tech Soup6 years ago • Written by Rick Gouin1 Comment

In my last article, I showed a simple way to read data from a Nutanix cluster using PHP. This method was simple because it didn’t have to send any data to the cluster, just retrieve it. We simply fetched a JSON file to show the data we wanted to show. That would be a perfect solution for making a pretty, end user consumable dashboard to show select pieces of system information.

What if you wanted to take action against your Nutanix cluster, however?  For example, what if you wanted to clone a VM, or create a new one, straight from your little home grown status page?

Well, that would require some changes to how we built the first query.  We’ll have to build a cURL session, provide some data, and then kick it off.  In the example below, I’ll use PHP to clone a VM.


This is not a complete, particularly useful script, and it isn’t meant to be. Its meant to give you an idea of how to send data to the Nutanix REST API using PHP. This could easily be adapted to use cURL directly as well. This same method will work for many of the “POST” API calls, though most of them will require you to include more parameters than this one. If you have any comments or questions on how you might use this, feel free to comment below.

TAGS: , ,

1 Comment so far. Feel free to join this conversation.

Leave A Response