Get VI Inventory

This API helps you retrieve lists of hosts and clusters. To get entities of a vCenter Server, the user must have Read privilege on the vCenter Server.


User Privilege

To call this API, you should be authenticated but no privileges are required.

Syntax

The syntax for calling this method is:

GET <Base_Url>/viInventory

For example, GET https://123.123.123.123/vCenter-CB/api/viInventory/entities?entityType=1

URL Parameters

You can provide the following optional parameters with the API call.

Name

Data Type

Required/Optional

Description

Sample Value

entityType

Integer

Required

Resource type such as HOST, CLUSTER_COMPUTE_RESOURCE, and DATASTORE. For a list of entity types, see Chargeback EntityTypes.

1

Request Parameters

The API does not need a request XML.

API Response

The API returns an XML that provides the following details.

XPath

Type

Min Occurs

Max occurs

Description

Entities/Entity

 

0

unbounded

Represents each entity in the vCenter hierarchy.

Entities/Entity/@id

xs:int

1

1

ID of the vCenter Server entity.

Entities/Entity/Name

xs:string

1

1

Name of the entity.

Entities/Entity/MoId

xs:string

1

1

MoID (managed object ID) of the entity as defined in the vCenter Server.

Entities/Entity/Type

xs:string

1

1

The type of the entity. For more information, see Chargeback Entity Types.

Entities/Entity/VCenterServer

 

1

1

Represents the vCenter Server details.

Entities/Entity/VCenterServer/@id

xs:int

1

1

ID of the vCenter Server.

Entities/Entity/VCenterServer/Name

xs:string

1

1

Name of the vCenter Server.

Entities/Entity/ExtraInfo

 

1

1

Represents the additional information retrieved for clusters.

Entities/Entity/ExtraInfo/hosts/Host

 

0

1

Represents the information about vCenter Server hosts present in the cluster. This element is available only for clusters.

Entities/Entity/ExtraInfo/hosts/Host/Name

xs:string

0

1

IP address of the vCenter Server host present in the cluster.

Entities/Entity/ExtraInfo/hosts/Host/Description

xs:string

0

1

Description of the vCenter Server host present in the cluster.

Entities/Entity/ExtraInfo/FileSystemType

xs:string

0

1

File system type of the datastore.

Entities/Entity/ExtraInfo/MultiPathingStatus

xs:string

0

1

MultiPathing status for the datastore.

Entities/Entity/ExtraInfo/ScsiPaths/ScsiPath

 

0

unbounded

ScsiPath for the datastore.

Entities/Entity/ExtraInfo/ScsiPaths/ScsiPath/Host

xs:string

1

1

ScsiPath host for the datastore.

Entities/Entity/ExtraInfo/ScsiPaths/ScsiPath/RuntimeName

xs:string

1

1

ScsiPath’s runtime name for the datastore.

Entities/Entity/ExtraInfo/ScsiPaths/ScsiPath/AdapterType

xs:string

1

1

Scsi adaptor type for the datastore.

Entities/Entity/ExtraInfo/ScsiPaths/ScsiPath/ScsiId

xs:string

1

1

Scsi volume Id for the datastore.

Entities/Entity/ExtraInfo/ScsiPaths/ScsiPath/Vendor

xs:string

1

1

Scsi volume vendor name.

Entities/Entity/ExtraInfo/StorageCapabilities

 

0

1

Storage capabilities for the datastore.

Entities/Entity/ExtraInfo/StorageCapabilities/StorageCapability

 

0

unbounded

Storage capability for the datastore.

Entities/Entity/ExtraInfo/StorageCapabilities/StorageCapability/@id

xs:int

1

1

ID of the storage capability for the datastore.

Entities/Entity/ExtraInfo/StorageCapabilities/StorageCapability/Name

xs:string

1

1

Name of the storage capability for the datastore.

Entities/Entity/ExtraInfo/StorageCapabilities/StorageCapability/Description

xs:string

1

1

Description of the storage capability for the datastore.

Entities/Entity/ExtraInfo/StorageCapabilities/StorageCapability/IsSystemDefined

xs:boolean

1

1

Whether the storage capability for the datastore is system defined or not.

For a sample response containing the list of clusters, click here.

For a sample response containing the list of hosts, click here.

For a sample response containing the list of datastore, click here.

Error Response

The following table explains the error codes displayed by the API.

Error code

Description

VCB_ERR_INVALID_ENTITY_TYPE

The specified entity type is invalid. For a list of vCenter Server entity types, see Chargeback Entity Types.