With the upcoming new release of vSphere, there are quite a few new vSphere APIs to look forward to and consume from an Automation standpoint. Similiar to what I had done in the past with previous major releases of vSphere, here is a list of of some of the new vSphere APIs (SOAP based) that I think are worth checking out whether they are new features vSphere 6.5 will introduced or new enhancements to existing functionality which will benefit our vSphere Administrators and/or Developers.
If you would like to see the complete list of new vSphere 6.5 (SOAP based) APIs, be sure to check out the vSphere 6.5 API Reference Guide which will include a "What's New" section on all the new Managed Objects, Methods, Properties, etc. when vSphere 6.5 is generally available.
CryptoManager / CryptoManagerKmip - VM Encryption is one of the new features in vSphere 6.5 and with these APIs, you will be able to manage and configure the VM Encryption settings including associating with KMIP server. For enabling/disabling VM Encryption at the VM and disk level, have a look at VirtualMachine->crypto and VirtualMachine->deviceChange->backing property.
- GenerateClientCsr
- GenerateKey
- GenerateSelfSignedClientCert
- ListKmipServers
- MarkDefault
- RegisterKmipServer
- RemoveKmipServer
- RetrieveClientCert
- RetrieveClientCsr
- RetrieveKmipServerCert
- RetrieveKmipServersStatus_Task
- RetrieveSelfSignedClientCert
- UpdateKmipServer
- UpdateKmsSignedCsrClientCert
- UpdateSelfSignedClientCert
- UploadClientCert
- UploadKmipServerCert
FailoverClusterConfigurator - To setup the new vCenter Server High Availability (VCHA) feature which is only available in the VCSA, use these APIs which include deploying and configuring the passive and witness nodes.
- configureVcha_Task
- createPassiveNode_Task
- createWitnessNode_Task
- deployVcha_Task
- destroyVcha_Task
- getVchaConfig
- prepareVcha_Task
FailoverClusterManager - Have a look at these APIs to initiate a failover or view the current VCHA configuration.
- getClusterMode
- GetVchaClusterHealth
- initiateFailover_Task
- setClusterMode_Task
HostVStorageObjectManager - An API only feature in vSphere 6.5 which will allow you to create and manage Virtual Disks as a "First Class" citizen. This particular API is for managing First Class Disks (FCD) when talking directly to an ESXi host.
- HostCloneVStorageObject_Task
- HostCreateDisk_Task
- HostDeleteVStorageObject_Task
- HostExtendDisk_Task
- HostInflateDisk_Task
- HostListVStorageObject
- HostReconcileDatastoreInventory_Task
- HostRegisterDisk
- HostRelocateVStorageObject_Task
- HostRenameVStorageObject
- HostRetrieveVStorageObject
- HostRetrieveVStorageObjectState
- HostScheduleReconcileDatastoreInventory
VcenterVStorageObjectManager - An API only feature in vSphere 6.5 which will allow you to create and manage Virtual Disks as a "First Class" citizen. This particular API is for managing First Class Disks (FCD) when talking directly to a vCenter Server.
- AttachTagToVStorageObject
- CloneVStorageObject_Task
- CreateDisk_Task
- DeleteVStorageObject_Task
- DetachTagFromVStorageObject
- ExtendDisk_Task
- InflateDisk_Task
- ListTagsAttachedToVStorageObject
- ListVStorageObject
- ListVStorageObjectsAttachedToTag
- ReconcileDatastoreInventory_Task
- RegisterDisk
- RelocateVStorageObject_Task
- RenameVStorageObject
- RetrieveVStorageObject
- RetrieveVStorageObjectState
- ScheduleReconcileDatastoreInventory
DatastoreNamespaceManager->ConvertNamespacePathToUuidPath() - From a troubleshooting standpoint, do you ever wish you can easily translate the human readable VM path (e.g. /vmfs/volumes/vsanDatastore/myVM/myVM.vmx to the VSAN/VVOL equivalent identifier which is UUID based? Well, this is now possible with this new API!
AuthorizationManager->FetchUserPrivilegeOnEntities() - This is a pretty neat API as it allows you to easily query an existing user to see the current privileges has been assigned. This could could come in handy to quickly audit a particular privilege for a user.
HostImageConfigManager->installDate() - Have a look at this blog post Super easy way of getting ESXi installation date in vSphere 6.5 for more details.
HostImageConfigManager->fetchSoftwarePackages() - This is another nice API to easily retrieve all the VIBs installed on an ESXi host. This is the equilvenet of running "esxcli software vib list" and you will now have all the additional metadata info that was historically only available via ESXCLI. Here is an example PowerCLI function called Get-ESXInstalledVib which exercises this new API.
HostStorageSystem->UpdateVmfsUnmapPriority() - Have a look at the blog post Configure new automatic Space Reclamation (VMFS UNMAP) using vSphere 6.5 APIs for more details.
VirtualMachine->{AttachDisk_Task(),DetachDisk_Task()} - This API allows you to attach and detach First Class Disks that you may have created earlier using the FCD APIs as shown above.
VirtualMachine->config->bootOptions->EfiSecureBootEnabled - To take advantage of the new VM Secure Boot feature in vSphere 6.5, you simply just toggle this property. Here are two PowerCLI functions called Get-SecureBoot/Set-SecureBoot which exercises this new API.
In addition, vSphere 6.5 also introduces a new REST-based API that covers several areas such as basic VM Lifecycle Management (simliar to that of the existing vSphere SOAP-based API), vSphere Content Library, vSphere Tagging and Virtual Appliance Management for the vCenter Server Appliance (VCSA). You can interact with these new APIs by using any of the vSphere Automation SDKs (.Net, Java, Python, Ruby or Perl) or even just simply using cURL from the command-line. It is really that easy!
Lastly, to make exploring these new REST-based APIs easier for both administrators as well as developers, there is now a new API Explorer that is included specifically with the VCSA in vSphere 6.5. You can think of it like a vSphere MOB 2.0 but way easier to use. Some of you may recognize the interface as shown in the screenshot below which uses the Swagger UI. This interface allows you to quickly browse through all the APIs, no need to refer to the documentation as the APIs are self-documented and made available in this interface. Best of all, you can even try out the APIs by simply logging into your vCenter Server and then selecting an API and clicking on the "Try it out now" button!
To access the API Explorer, you simply open a web browser and enter the following URL: https://[VC-HOSTNAME-OR-IP]/apiexplorer/
There will also be native PowerCLI cmdlets (Get-CisService) to these new REST API and below is a quick example of retrieving the version (GET /system/version) of the VCSA:
$vcsaVersion = Get-CisService -Name 'com.vmware.appliance.system.version'
$vcsaVersion.get()
Great post, one minir thing.
"vSphere 6.5 API Reference Guide" link seems to be dead (404), working one available before GA ?
Yes, that's because vSphere 6.5 has GA'ed yet 🙂 When it does, the link will work
When are vsphere replication APIs going to be open to public? i think it is the most requested API, hyperv can automate/orchestrate replication through API from years ago.
I understand you want to sell SRM but many people dont need it and just want to do some basic automation over the replicas.
Will these APIs also be available in vCenter Server on Windows? 🙂
William. Thanks for this. This is the only reference i have found to First Class Disks. I am trying to experiment with them but cannot seem to crack this API. Any help would be great.
Connected to a 6.5 vCenter using powercli 6.5 and I can get-view any of the other new object managers. But this one doesn't seem to respond the same way:
PowerCLI C:\> get-view VcenterVStorageObjectManager
get-view : 11/22/2016 1:23:56 AM Get-View View with Id 'VcenterVStorageObjectManager-VcenterVStorageObjectManager' was not found on the server(s).
At line:1 char:1
+ get-view VcenterVStorageObjectManager
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
+ FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
I have the following spec setup in hopes to create a FCD once i can find the manager to create the task off of:
$datastore = Get-Datastore vsanDatastore
$spec = new-object VMware.Vim.VslmCreateSpec
$spec.BackingSpec = new-object VMware.Vim.VslmCreateSpecBackingSpec
$spec.BackingSpec.Datastore = $datastore.ExtensionData.MoRef
$spec.Name = "testFCD"
$spec.CapacityInMB = 1024
William,
As always, thanks for your great help. You are without a doubt the best resource for developers trying to work with any of VMware's products. Mr. Gelsinger, if you are listening, please support Mr. Lam with anything he needs, this is how you get and keep developers.
William,
Thanks for all the information. Any idea if we can access the tags [Virtual Machine tags specifically] in the new SDK. I was planning to use govmomi but didn't find any way to access tags.
Thanks
As far as I can tell VMware still provides no access to tags in the webservices api, seems kind-of crazy that this is still the case 🙁
hi WIlliam , do you know the endpoint name so that i can access the vSphere Web API via rest? I want to get stuff like VM disk sizes and drive letters and the automation API doesn't have that data.
Both this post and the API are very helpful indeed. My goal is to enable ssh and root login after an VM deployment, but I only found "put /appliance/access/ssh" under "Appliance". Where do I find similar things for VM? Thanks
Thanks for this article, William.
Can CloneVStorageObject_Task API be used to copy a disk(vmdk file) from one data store to another?
Can you please point me to any sample for usage of this API?