Since vSphere 6.0, vSphere has been providing more and more REST based APIs.In vSphere 6.5, we introduced a new API Explorer and a number of new REST APIs, these also received significant updates in the vSphere 6.7 release. The vCenter API infrastructure provides json based metadata which describes APIs available in vCenter. This format is conceptually similar to the OpenAPI specification.

Today we are excited to announce a new, open-source project known as the VMware OpenAPI Generator.

The VMware OpenAPI Generator is a python-based utility which, when pointed at a vCenter server, can read all of the available API metadata and convert them into OpenAPI specifications. This allows you and 3rd party vendors to take advantage of all the available OpenAPI tooling to create additional artifacts such as documentation, code generators, and more.

Let’s take a look at how to use the VMware OpenAPI Generator.

VMware OpenAPI Generator

This new tool can be found on the VMware GitHub repository: VMware OpenAPI Generator

In order to make use of the tool, we’ll need to start by making the repository available on your local machine, by either clicking on the green “Clone or Download” button and selecting “Download Zip” or by simply running the following command:

The other requirements are having Python and the vSphere Automation SDK for Python. Additional information about the installation process of both can be found at the following blog: Getting Started with the vSphere Automation SDK for Python

Once the above has been completed, we’re ready to produce our OpenAPI specifications based on a running vCenter server.

In this example, I’ll be using MacOS. I’ll open up a terminal session, change to the directory of our local copy of the “vmware-openapi-generator” repo, and use the following code:

Example: Generating OpenAPI Specs

Once complete, you should see the directory specified after the “o”(output) parameter has a number of JSON files containing each of the available REST services’ OpenAPI specifications.


Documentation Generator Example

OpenAPI specifications offers the ability to create any number of additional resources. One example of which is documentation. We can now take the newly generated specs for each of the vSphere API services and use a tool, like ReDoc, to then create a set of documentation. We can then combine it with other REST services to give us a consistent feel across all of our API documentation!

Let’s walk through a quick example of generating some documentation for the vCenter service using the ReDoc docker container:

We can now open a browser and view our vCenter service documentation!

Example: ReDoc version of VMware OpenAPI Spec


The vSphere REST APIs continue to get better with every release. We are also creating tools, such as the brand-new VMware OpenAPI Generator, which allows customers, partners and integrators to take advantage of all the tooling available in the OpenAPI ecosystem or custom projects which work with the OpenAPI format.

Download the VMware OpenAPI Generator today and let us know what you’re most excited about creating with these specs!