VMware Cloud Foundation Compute (vSphere) Products Technical VMware vSphere Foundation

Simplifying vSphere APIs and SDKs for a better developer experience

Improving developer experience is one of the top priorities as we move forward with VMware Cloud Foundation (VCF). We achieve this by offering a set of APIs, SDK bindings, and CLI interface to automate and administer VCF. Recently, with the release of VMware vSphere 8 Update 3, we have introduced key enhancements in our API and SDK capabilities. These enhancements simplify authentication and delivery aspects of APIs and SDKs. 

These enhancements are – 

  1. Unified single session API authentication 
  2. Extending VI/JSON capabilities
  3. Merging vSAN SDK with pyvmomi
  4. Publishing vSphere Automation Python SDK in PyPI

Unified Single Session Authentication

VMware vSphere has two major APIs – vSphere Automation API (VAPI) and vSphere Web Service API (VIM). The vSphere Automation API introduced in vSphere 7 and applies REST design principles, using JSON-based wire protocols. The vSphere Web Service API applies RPC principles using a SOAP protocol and offers backward compatibility with the older vSphere features. Both the APIs are important as they complement each other to provide full vSphere coverage to the developers. 

Earlier, developers couldn’t use a single session interchangeably and were required to establish separate authentication sessions for vSphere Automation API and vSphere Web Service API respectively. This caused a degree of overhead and inefficiency with respect to how developers authenticate with vSphere APIs. 

Starting from vSphere 8 Update 3, developers can now establish a single session with any one of the API and re-use the same session in another API endpoint.

Example

As shown in the above example, We are creating a session using vSphere Automation API (VAPI) endpoint and reusing the same session in vSphere Web Service API  endpoint and vice-versa.

Single Session across Java and Python SDKs

Developers consume vSphere APIs using Java and Python based SDKs. Starting from vSphere 8 Update 3, developers can access all the vSphere libraries using a single session. For example, developers who use python based SDKs can establish a session with any of the one SDK, vSphere Management SDK (pyvmomi, Python), vSphere Automation SDK (Python), or vSAN SDK (Python), and reuse it interchangeably. The same behavior applies across all the JAVA based SDKs as well.

Example

The above example demonstrates authentication sessions established using pyVmomi, the python SDK for vSphere Web Service APIs and then reusing the same session in Python SDK for vSphere automation APIs. 

Extending VI/JSON capabilities

The vSphere Web Service APIs are based on the industry-standard SOAP protocol, using the XML data format. While XML has proven to be a powerful data format, it is more complex compared to JSON. In contrast, REST APIs work with the JSON data format, which is modern and easy to work with.

Starting with vSphere 8 Update 1, we introduced a new wire protocol called VIJSON for Virtual Infrastructure Management (VIM) APIs. This protocol facilitates an easy transition from SOAP-based APIs to REST-like APIs, adhering to OpenAPI 3.0 specifications.

Starting from vSphere 8 Update 3, we are expanding VIJSON coverage to other SOAP API endpoints such as Storage Policy Based Management (SPBM), Storage Monitoring Service (SMS), and Virtual Storage Lifecycle Management (VLSM). Additionally, all VIJSON APIs can now be accessed through a single API endpoint. This consolidation allows vim25, SPBM, SMS, and VLSM to be accessed in JSON format via a unified endpoint, marking a significant step toward a unified API endpoint for vSphere.

Merging vSAN Python SDK with pyvmomi

We have merged vSAN python SDK into pyVmomi. Now, downloading and installing pyVmomi automatically includes the  vSAN Python SDK as well. This greatly simplifies the onboarding experience and eliminates the need for manual steps to configure the VSAN Python SDK.

Additionally, vSAN Python samples are also merged with pyVmomi and can be found in pyvmomi-community-samples. Merging the vSAN python SDK also allows unified authentication with pyvmomi, thus eliminating the need to manage separate authentication.

Publishing vSphere Automation SDK to PyPI

In addition to the announced merger, we are responding to customer requests by making both vSphere Python SDKs available on PyPi. This enhancement will streamline the delivery of our new SDK versions to our customers. 

Now, pyVmomi, along with vSAN, and vCenter Automation Python SDK for vSphere are accessible on PyPi. This achievement marks a significant milestone and represents the initial step towards consolidating all VMware SDKs into a unified VCF Python SDK and a single VCF Java SDK.

Resources

  1. An introduction to vSphere APIs  
  2. Getting started with vSphere APIs and SDKs  
  3. Introducing VI/JSON – a modern wire protocol for vSphere management

Authors and Contributors

Jatin Purohit, Product Marketing Engineer, VCF

Angel Petrov, Product Manager, VCF