REST API - GET Virtual Machine Browse

This operation browses virtual machines.

Request

Syntax

GET <webservice>/VMBrowse?PseudoClientId={PseudoClientId}&inventoryPath={\type:name}&server={server} HTTP/1.1
Host: <host name>
Accept: application/xml
Authtoken: <authentication token>

where <webservice> is the root path used to route the API requests to the Web Server.

For more information, see Available Web Services for REST API.

Request Parameter

Name

Description

Required

PseudoClientId

The client ID for the virtualization client. If the client ID is not known, use the GET Virtualization Client API to retrieve it.

Yes

inventoryPath

The type and name of the entity to browse. Prefix the type with a backslash (\) and the name with a colon (:). The backslash and colon must be encoded before they are sent in the request, for example, inventoryPath=%5Cnone%3AVMs. To find the initial values for type and name, send a request without an inventory path, for example, VMBrowse?PseudoClientId=2.

After each browse, new type and name parameters can be added the request, for example:

  1. VMBrowse?PseudoClientId=3

  2. VMBrowse?PseudoClientId=3&inventoryPath=%5Cnone%3AVMs

  3. VMBrowse?PseudoClientId=3&inventoryPath=%5Cnone%3AVMs%5CDATACENTER%3Adc002

No

server

The name of the virtual machine host to browse. If the server parameter is used, custom headers are required. For information, see the Request Header section.

No

Request Header

Standard

Name

Description

Host

The host name of the web server.

Accept

The format of the response. Valid values are: application/xml or application/json.

Authtoken

The authentication token received after successfully logging on. For details on receiving an authentication token, see Authentication.

Custom

Name

Description

login

The logon ID for the server defined in the server request parameter. This header is required if the server request parameter is used.

password

The password for the logon ID defined in the login header. This header is required if the server request parameter is used.

Response

Response Parameters

Parameter

Description

Element

name

The name of the entity.

inventoryInfo

poweredOff

inventoryInfo

strGUID

The globally unique identifier for the virtual entity.

inventoryInfo

templateVM

Indicates if the virtual machine is a template.

Valid values are 0/1.

inventoryInfo

type

The type of entity. Requests that do not include an inventory path parameter always return a type of 0.

Valid values are:

  • 0, for none

  • 1, for server host

  • 2, for resource pool

  • 4, for datacenter

  • 6, for cluster

  • 7, for datastore

  • 8, for datastore cluster

  • 9, for virtual machine

  • 10, for virtual machine name

  • 24, for datastore list

inventoryInfo

Examples

Sample Request

This request does not include an inventory path.

GET <webservice>/VMBrowse?PseudoClientId=2 HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

This request includes an inventory path built from the type and name parameters found in the response returned from the VMBrowse?PseudoClientId=2 request.

GET <webservice>/VMBrowse?PseudoClientId=2&inventoryPath=%5CNONE%3AHosts HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

Sample Response

This is the response when the request does not include an inventory path.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
 <EVGui_BrowseInventory>
   <inventoryInfo name="Hosts" poweredOff="1" strGUID="" templateVM="0" type="0" />
   <inventoryInfo name="VMs" poweredOff="1" strGUID="" templateVM="0" type="0" />
   <inventoryInfo name="Datastores" poweredOff="1" strGUID="" templateVM="0" type="0" />
 </EVGui_BrowseInventory>

This is the response when the request does include an inventory path.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
 <EVGui_BrowseInventory>
   <inventoryInfo name="VM001" poweredOff="1" strGUID="datacenter-8027" templateVM="0" type="4" />
   <inventoryInfo name="VM002" poweredOff="1" strGUID="datacenter-3205" templateVM="0" type="4" />
   <inventoryInfo name="VM003" poweredOff="1" strGUID="datacenter-2" templateVM="0" type="4" />
   <inventoryInfo name="VM004" poweredOff="1" strGUID="datacenter-6425" templateVM="0" type="4" />
 </EVGui_BrowseInventory>

Loading...