Code Samples – Nutanix Developer Code Samples – Nutanix Developer

Code Samples

DOCUMENTATION

The official Nutanix REST API reference

BLOG

Curated content for the Nutanix developer community

COMMUNITY

Join us community to discuss everything about Nutanix development

The code samples provided here are intended as standalone examples.  They can be downloaded, copied and/or modified in any way you see fit.

Please be aware that all code samples provided here are unofficial in nature, are provided as examples only, are unsupported and will need to be heavily modified before they can be used in a production environment.

Most code samples can be directly accessed from the NutanixDev GitHub code samples repo.  Larger samples will be published via dedicated repos when required.

Languages & Scripts

Python

These samples require Python 3.7 or later and demonstrate complete, standalone scripts for carrying out common API operations.

For easy sharing of parameters between scripts, most scripts accept their JSON payloads via an on-disk JSON-formatted text file.

All scripts utilise requests, urllib3, getpass, argparse and json modules.

Repo directory: python

Bash Shell

These samples are written specifically for use with Bash Shell; please note that modification will be required before use with the sh shell.  All scripts are standalone and can be run without any other script dependencies.

All scripts utilise jq, a free sed-like JSON processor.  JQ can be downloaded from here.

Repo directory: shell

C#

These samples are intended for use with Visual Studio.  Visual Studio Community can be downloaded from here.

All C# code samples utilise Newtonsoft.Json, a popular high-performance JSON framework for .NET.  Please see here for instructions on installing Newtonsoft.Json into your Visual Studio environment.

Repo direction: csharp

PowerShell

A default installation of PowerShell, e.g. on Windows 10 or Windows 2016 (or later) should have all required packages available.

To run these scripts the PowerShell ExecutionPolicy will need to be set to RemoteSigned.  To do this, run the following command in an administrative PowerShell session:

SetExecutionPolicy RemoteSigned

Repo directory: powershell