vcenter VM: list

Returns information about at most 1000 visible (subject to permission checks) virtual machines in vCenter matching the vcenter.VM.filter_spec.

Request:

HTTP request

GET https://{server}/rest/vcenter/vm

?filter.power_states.1=POWERED_OFF
&filter.power_states.2=POWERED_OFF
&filter.resource_pools.1=obj-103
&filter.resource_pools.2=obj-103
&filter.clusters.1=obj-103
&filter.clusters.2=obj-103
&filter.datacenters.1=obj-103
&filter.datacenters.2=obj-103
&filter.names.1=string
&filter.names.2=string
&filter.hosts.1=obj-103
&filter.hosts.2=obj-103
&filter.vms.1=obj-103
&filter.vms.2=obj-103
&filter.folders.1=obj-103
&filter.folders.2=obj-103

Request Query Parameters:

Name Type Description
bold = required
filter filter_spec Optional. Specification of matching virtual machines for which information should be returned.
filter.vms string[] Identifiers of virtual machines that can match the filter.

Optional. If unset or empty, virtual machines with any identifier match the filter.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: VirtualMachine. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: VirtualMachine.

filter.names string[] Names that virtual machines must have to match the filter (see vcenter.VM.info.name).

Optional. If unset or empty, virtual machines with any name match the filter.

filter.folders string[] Folders that must contain the virtual machine for the virtual machine to match the filter.

Optional. If unset or empty, virtual machines in any folder match the filter.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: Folder. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: Folder.

filter.datacenters string[] Datacenters that must contain the virtual machine for the virtual machine to match the filter.

Optional. If unset or empty, virtual machines in any datacenter match the filter.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: Datacenter. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: Datacenter.

filter.hosts string[] Hosts that must contain the virtual machine for the virtual machine to match the filter.

Optional. If unset or empty, virtual machines on any host match the filter.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: HostSystem. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: HostSystem.

filter.clusters string[] Clusters that must contain the virtual machine for the virtual machine to match the filter.

Optional. If unset or empty, virtual machines in any cluster match the filter.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: ClusterComputeResource. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: ClusterComputeResource.

filter.resource_pools string[] Resource pools that must contain the virtual machine for the virtual machine to match the filter.

Optional. If unset or empty, virtual machines in any resource pool match the filter.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: ResourcePool. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: ResourcePool.

filter.power_states string[] Power states that a virtual machine must be in to match the filter (see vcenter.vm.power.info.state.

Optional. If unset or empty, virtual machines in any power state match the filter.

Response:

HTTP Status Code: 200

Representations:

{
    "value"[
        {
            "cpu_count"1,
            "memory_size_MiB"1,
            "name""string",
            "power_state""POWERED_OFF",
            "vm""obj-103"
        },
        {
            "cpu_count"1,
            "memory_size_MiB"1,
            "name""string",
            "power_state""POWERED_OFF",
            "vm""obj-103"
        }
    ]
}
<?xml version="1.0" ?>
<ns0:List-Result xmlns:ns0="http://vmware.com/vcenter/VM" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <value-array>
    <array-item>
      <cpu_count>1</cpu_count>
      <vm>obj-103</vm>
      <memory_size_MiB>1</memory_size_MiB>
      <power_state>POWERED_OFF</power_state>
      <name>string</name>
    </array-item>
    <array-item>
      <cpu_count>1</cpu_count>
      <vm>obj-103</vm>
      <memory_size_MiB>1</memory_size_MiB>
      <power_state>POWERED_OFF</power_state>
      <name>string</name>
    </array-item>
  </value-array>
</ns0:List-Result>

Response Type:

Name Type Description
bold = required
value summary[] Commonly used information about the virtual machines matching the vcenter.VM.filter_spec.
value[].vm string Identifier of the virtual machine.

When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: VirtualMachine. When operations return a value of this structure as a result, the field will be an identifier for the resource type: VirtualMachine.

value[].name string Name of the Virtual machine.

value[].power_state string Power state of the virtual machine.

Defines the valid power states for a virtual machine. Value is one of:
POWERED_OFF: The virtual machine is powered off.
POWERED_ON: The virtual machine is powered on.
SUSPENDED: The virtual machine is suspended.

value[].cpu_count long Number of CPU cores.

Optional. This field will be unset if the virtual machine configuration is not available. For example, the configuration information would be unavailable if the server is unable to access the virtual machine files on disk, and is often also unavailable during the intial phases of virtual machine creation.

value[].memory_size_MiB long Memory size in mebibytes.

Optional. This field will be unset if the virtual machine configuration is not available. For example, the configuration information would be unavailable if the server is unable to access the virtual machine files on disk, and is often also unavailable during the intial phases of virtual machine creation.

Errors:

HTTP Status Code Type Description
400 invalid_argument if the vcenter.VM.filter_spec.power_states field contains a value that is not supported by the server.
400 unable_to_allocate_resource if more than 1000 virtual machines match the vcenter.VM.filter_spec.
503 service_unavailable if the system is unable to communicate with a service to complete the request.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user doesn't have the required privileges.