Nutanix v4 API Update: February 2023

1100X627-long

Table of Contents

Starting in Nutanix Prism Central version pc.2022.6, Prism Central has included the first early access (EA) versions of the new Nutanix v4 REST APIs and SDKs. Representing a ground-up approach to API and documentation design, support for new features and capabilities are being made available with each release.

Prism Central version pc.2022.9, made available on January 23rd 2023, represents a significant update to the new APIs and SDKs. The highlights of this release are the subject of today’s article.

v4 API User Guide

Along with the general availability of Prism Central pc.2022.9, we have published the Nutanix v4 API User Guide. This guide includes the following highlights.

  • Nutanix v4 API and SDK requirements, environment preparation and configuration
  • Getting started with the Nutanix v4 APIs
  • Making requests with the Nutanix v4 REST APIs and SDKs
  • Interpreting and parsing responses with the Nutanix v4 REST APIs and SDKs
  • Using new Nutanix v4 REST API and SDK features such as OData support and compliance: Filtering, sorting, limiting, result pagination
  • Request idempotency
  • Resource Etags
  • Complete, downloadable code samples demonstrating the use of many highlighted new features

For more information see the full Nutanix v4 API User Guide.

Namespace Availability

The following Nutanix v4 API namespaces are now available as Early Access in Prism Central.

  • vmm: Mostly commonly used for virtual machine and image CRUD operations.
  • storage: Most commonly used for operations on storage-specific entities such as storage containers.
  • networking: Most commonly used for operations on network-specific entities such as subnets, virtual switches, VPCs.
  • security-dashboard: Get information about the hardening settings displayed in the Prism Central UI.

For more information see the Nutanix v4 API Introduction.

New Code Samples

The following Python code samples have been added to the Nutanix.dev code sample repository.

Create Prism Central VM (SDK)

This code sample demonstrates the following Nutanix v4 API features.

  • Using multiple Nutanix v4 Python SDK namespaces to create a new Prism Central virtual machine:
    • clustermgmt: Select the Nutanix cluster that will host the new VM.
    • storage: Select the storage container that will manage the new VM’s attached disk.
    • networking: Select the cluster subnet the new VM’s network interface will connect to.
    • vmm: Create the new virtual machine.
    • prism: Monitor the virtual machine creation task.
  • Creation and management of multiple Prism Central connections across multiple namespaces

View the code sample here: v4 API: Create Prism Central VM (Python SDK)

Update Prism Central Image (SDK)

This code sample demonstrates the following Nutanix v4 API features.

  • Using the Nutanix v4 Python SDK vmm namespace to update the name of an existing Prism Central image.
  • Use resource Etag to ensure mid-air collisions are avoided in the event multiple users modify the same resource.

View the code sample here: v4 API: Update Prism Central Image with Resource Etag (Python SDK)

Update Prism Central Image (requests Library)

This code sample demonstrates the following Nutanix v4 API features.

  • Using the Nutanix v4 REST APIs to update the name of an existing Prism Central image.
  • Use resource Etag to ensure mid-air collisions are avoided in the event multiple users modify the same resource.
  • Use Ntnx-Request-Id headers to ensure each request is only submitted once. Avoids the possibility of a single request executing the same actions multiple times.

View the code sample here: v4 API: Update Prism Central Image with request idempotency and Resource Etag (Python `requests` Library)

Create Prism Central Image (SDK)

This code sample demonstrates the following Nutanix v4 API features.

  • Using the Nutanix v4 Python SDK vmm namespace to create a new Prism Central image. The image used is the publicly-available CentOS 7 Cloud qcow2 image.

View the code sample here: v4 API: Create Prism Central Image (Python SDK)

Related Resources

See the following resources for more details on the new Nutanix v4 REST API and SDK features.

© 2024 Nutanix, Inc. All rights reserved. Nutanix, the Nutanix logo and all Nutanix product, feature and service names mentioned herein are registered trademarks or trademarks of Nutanix, Inc. in the United States and other countries. Other brand names mentioned herein are for identification purposes only and may be the trademarks of their respective holder(s). This post may contain links to external websites that are not part of Nutanix.com. Nutanix does not control these sites and disclaims all responsibility for the content or accuracy of any external site. Our decision to link to an external site should not be considered an endorsement of any content on such a site. Certain information contained in this post may relate to or be based on studies, publications, surveys and other data obtained from third-party sources and our own internal estimates and research. While we believe these third-party studies, publications, surveys and other data are reliable as of the date of this post, they have not independently verified, and we make no representation as to the adequacy, fairness, accuracy, or completeness of any information obtained from third-party sources.