/ #api #vcenter 

New vSphere 6.5 REST API and API Explorer

vSphere 6.5 (released last week) introduces a new REST API providing a much more modern, simplified and developer-friendly API. The areas covered by the REST API are currently limited to vCenter Server Appliance (vCSA) management, Content Library and VM operations and lifecycle (check below for a more complete list). Also, to make our life easier, this new API is self-documented via an API Explorer embedded in the vCenter Server Appliance.

Browse to the root of your vCenter (https://[vCenter-IP-or-FQDN]) to reach the API Explorer, and click on the “Browse vSphere REST APIs” link on the right.

Browse vSphere REST APIs in vCenter 6.5 UI

You can expand / collapse the various sections to get a clear and complete documentation on each API call: description, required fields, request body, detailed filter information, list of responses messages, and so on.

VM Operations Documentation using the API Explorer

Doesn’t this interface looks familiar? Maybe because it uses the Swagger UI. :)

New vSphere 6.5 REST API: create a VM directly from the documentation

Have you noticed this “Try it out!” button?

New vSphere 6.5 REST API: get all VMs example

You can manage the following areas from the REST API:

  • VM Management (select ‘vcenter’ API in the top drop down menu):

    • VM creation and management

    • VM power operations

    • Virtual hardware management

  • Virtual Datacenter Management (select ‘vcenter’ API in the top drop down menu):

    • Mostly read operations,

    • Datacenter

  • Appliance configuration (select ‘appliance’ API in the top drop down menu):

    • Access (Shell, SSH, DCUI)

    • Network configuration

    • System settings (NTP and time settings, SNMP, power operations, etc.)

  • Appliance health (select ‘appliance’ API in the top drop down menu):

    • Monitor system health (disk space, memory, load, databases, etc.)

    • Monitor services

  • Appliance backup and recovery (select ‘appliance’ API in the top drop down menu)

  • Content Library (select ‘content’ API in the top drop down menu):

    • Configuration

    • Items management

  • …and much more.

Don’t hesitate to have a look at the REST API Explorer, it’s very handy! :)

Author

Romain

Staff Architect & Member of the CTO Ambassador Program at VMware, focusing on NSX and Cloud-Native Applications. He is a double VCDX (DCV and NV, #120), VCDX panelist, frequent VMUG/VMworld speaker and contributor to the community via this blog or social media (follow him on Twitter @woueb).