Home > vSphere API > Most Used API in vSphere

Most Used API in vSphere

Yesterday I blogged about the least used API in VMware vSphere. This naturally leads to another question, “what is the most used API in vSphere?” It’s a harder question than the “least” one, because for the latter I can be very sure that zero is the lowest possible usage. If that API is not the least, it must be one of the least.

Before we try to figure out the answer, let’s clarify a bit the “most used.” Does it mean the one that is called the most times? Does it mean the one that is touched and used by most developers? For the first case, it’s very hard, if possible, to get the stats. For the second, it seems a bit easier. So we will stick with the second definition: the API used by most developers.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure


As you may have known that vSphere APIs are the Web Service layer on top of which several different toolkits are built, for example, vSphere Java API, VI Perl, PowerCLI, etc. With the introduction of high level APIs/toolkits, some vSphere APIs are hidden. For example, vSphere Java API provides explicit getter methods with each managed object type for reading its properties. Underneath these getter methods is the PropertyCollector. In most cases, a developer using vSphere Java API does not need to even know about PropertyCollector, but it doesn’t mean she is not using the PropertyCollector at Web Service layer. For simplicity, we will base our discussion on the vSphere Web Services APIs.

Compared with any other managed objects in vSphere API, the PropertyCollector received unproportionally high attention among the developers especially for the newcomers. The reason for that is the PropertyCollector is almost the only way to get any properties of a managed object in vSphere API. Should you develop anything useful, it’s most likely that you want to use it to read properties of some 90+ managed objects like VirtualMachine, HostSystem, etc., before taking any actions by calling other methods. For that, we can safely pin down the scope to the PropertyCollector itself.

Depending on your definition of API, the class/type may well be the API. For others, it’s more like a method. Among the several methods in the PropertyCollector, I think it’s fair to say that the retrieveProperties() and its newer equivalent retrievePropertiesEx(), as shown below, are the most used mainly because they are relatively easy one to use. I have to admit that it also depends on your application – you can also choose to use more the checkForUpdates() and waitForUpdates() (or its newer waitForUpdatesEx).

/** @deprecated as of SDK4.1 */
public ObjectContent[] retrieveProperties(PropertyFilterSpec[] specSet) throws InvalidProperty, RuntimeFault, RemoteException
  return getVimService().retrieveProperties(getMOR(), specSet);
 /** @since SDK4.1 */
public RetrieveResult retrievePropertiesEx(PropertyFilterSpec[] specSet, RetrieveOptions options) throws InvalidProperty, RuntimeFault, RemoteException
  return getVimService().retrievePropertiesEx(getMOR(), specSet, options);

  1. Angela
    July 25th, 2011 at 06:02 | #1

    Very right Steve!

  1. No trackbacks yet.