Document navigation

vCenter Operations

The VMware Management feature is provided in a separate module. Before you can use this feature, you need to purchase the Plus License of VMware Management, in addition to the Base License.

AddVCenter

API Request

URLs
POST zstack/v1/vcenters
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "username": "admin@vsphere-local.net",
    "password": "test-pass",
    "zoneUuid": "25b9e68b1cc43836a79f1a35e3108880",
    "name": "vc1",
    "https": true,
    "domainName": "vsphere-local.net"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"username":"admin@vsphere-local.net","password":"test-pass","zoneUuid":"25b9e68b1cc43836a79f1a35e3108880","name":"vc1","https":true,"domainName":"vsphere-local.net"}}' \
http://localhost:8080/zstack/v1/vcenters
Request Parameters
Name Type Location Description Optional Value Starting Version
username String body (contained in the params structure) The user name used to log in to the vCenter. 0.6
password String body (contained in the params structure) The password used to log in to the vCenter. 0.6
zoneUuid String body (contained in the params structure) The UUID of the zone to which the vCenter is added. 0.6
name String body (contained in the params structure) The name of the vCenter. 0.6
https boolean body (contained in the params structure) Optional. Whether to enable HTTPS login. By default, HTTPS login is enabled. 0.6
domainName String body (contained in the params structure) The domain name of the vCenter. 0.6
description String body (contained in the params structure) Optional. The detailed description of the vCenter. 0.6
resourceUuid String body (contained in the params structure) Optional. The vCenter UUID. If specified, the VM instance will use the specified value as the UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
port Integer body (contained in the params structure) Optional. 0.6

API Response

Sample Response
{
  "inventory": {
    "uuid": "1497ae9206ea3f82bb13c34c307299b9",
    "name": "vc1",
    "domainName": "vsphere-local.net",
    "userName": "admin@vsphere-local.net",
    "https": true,
    "state": "Enabled",
    "status": "Connected"
  },
  "skippedResources": {
    "vmInstances": [
      {
        "uuid": "example",
        "name": "exampleVm"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean 4.5.3
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory VCenterInventory See inventory. 0.6
skippedResources SkippedResources For more information, see skippedResources. 4.5.3
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
domainName String 0.6
port Integer 0.6
userName String 0.6
zoneUuid String The zone UUID. 0.6
https Boolean 0.6
state String 0.6
status String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#skippedResources
Name Type Description Starting Version
vmInstances Set For more information, see vmInstances. 4.5.3
#vmInstances
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
name String The resource name. 4.5.3
description String Optional. The detailed description of the resource. 4.5.3
zoneUuid String The zone UUID. 4.5.3
clusterUuid String The cluster UUID. 4.5.3
imageUuid String The image UUID. 4.5.3
hostUuid String The host UUID. 4.5.3
lastHostUuid String 4.5.3
instanceOfferingUuid String The instance offering UUID. 4.5.3
rootVolumeUuid String The root volume UUID. 4.5.3
platform String 4.5.3
architecture String The architecture type. 4.5.3
defaultL3NetworkUuid String 4.5.3
type String 4.5.3
hypervisorType String 4.5.3
memorySize Long 4.5.3
cpuNum Integer 4.5.3
cpuSpeed Long 4.5.3
allocatorStrategy String 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
state String 4.5.3
guestOsType String The operating system type. 4.5.3
vmNics List For more information, see vmNics. 4.5.3
allVolumes List For more information, see allVolumes. 4.5.3
vmCdRoms List For more information, see vmCdRoms. 4.5.3
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
vmInstanceUuid String The VM instance UUID. 4.5.3
l3NetworkUuid String The L3 network UUID. 4.5.3
ip String The IP address. 4.5.3
mac String The MAC address. 4.5.3
hypervisorType String The hypervisor type. 4.5.3
netmask String The sub network mask. 4.5.3
gateway String The gateway. 4.5.3
metaData String 4.5.3
ipVersion Integer The IP address. 4.5.3
deviceId Integer The device ID. 4.5.3
type String The NIC type. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
usedIps List For more information, see usedIps. 4.5.3
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
ipRangeUuid String The IP range UUID. 4.5.3
l3NetworkUuid String The L3 network UUID. 4.5.3
ipVersion Integer The IP version. 4.5.3
ip String The IP address. 4.5.3
netmask String The network mask. 4.5.3
gateway String The gateway address 4.5.3
usedFor String 4.5.3
ipInLong long 4.5.3
vmNicUuid String The UUID of the VM instance NIC. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
name String The resource name. 4.5.3
description String Optional. The detailed description of the resource. 4.5.3
primaryStorageUuid String The primary storage UUID. 4.5.3
vmInstanceUuid String The VM instance UUID. 4.5.3
diskOfferingUuid String The disk offering UUID. 4.5.3
rootImageUuid String The root image UUID. 4.5.3
installPath String The mount path of the volume on the primary storage. 4.5.3
type String The volume type, including data volume and root volume. 4.5.3
format String The volume format. 4.5.3
size Long The volume size. 4.5.3
actualSize Long The volume actual size. 4.5.3
deviceId Integer 4.5.3
state String The running state of the volume. 4.5.3
status String The ready status of the volume. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
isShareable Boolean The sharing mode of the volume. 4.5.3
volumeQos String The volume QoS. Syntax sample: total=1048576 4.5.3
#vmCdRoms
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
vmInstanceUuid String The VM instance UUID. 4.5.3
deviceId Integer The drive sequence number. 4.5.3
isoUuid String The ISO image UUID. 4.5.3
isoInstallPath String The mount path of the ISO image. 4.5.3
name String The resource name. 4.5.3
description String Optional. The detailed description of the resource. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3

SDK Sample

Java SDK
AddVCenterAction action = new AddVCenterAction();
action.username = "admin@vsphere-local.net";
action.password = "test-pass";
action.zoneUuid = "25b9e68b1cc43836a79f1a35e3108880";
action.name = "vc1";
action.https = true;
action.domainName = "vsphere-local.net";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddVCenterAction.Result res = action.call();
Python SDK
AddVCenterAction action = AddVCenterAction()
action.username = "admin@vsphere-local.net"
action.password = "test-pass"
action.zoneUuid = "25b9e68b1cc43836a79f1a35e3108880"
action.name = "vc1"
action.https = true
action.domainName = "vsphere-local.net"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddVCenterAction.Result res = action.call()

QueryVCenter

API Request

URLs
GET zstack/v1/vcenters
GET zstack/v1/vcenters/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e46c3ba50f324bcbabda6c40d11d1e33" \
-X GET http://localhost:8080/zstack/v1/vcenters?q=uuid=7e580c2f8b6c4e31aff447c45c72c3bb
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth d0552ed3feb243a1b87fcff421388964" \
-X GET http://localhost:8080/zstack/v1/vcenters/bb39998d05004cd9aa5bf816cc308ed1

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVCenter, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "b84429ea486d3e878afd4175bff667e0",
      "name": "vc1",
      "domainName": "vsphere-local.net",
      "userName": "admin@vsphere-local.net",
      "version": "6.0.0",
      "https": true,
      "state": "Enabled",
      "status": "Connected"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.9.0
inventories List See inventories. 3.9.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.9.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
name String The resource name. 3.9.0
description String The detailed description of the resource. 3.9.0
domainName String 3.9.0
port Integer 3.9.0
userName String 3.9.0
zoneUuid String The zone UUID. 3.9.0
version String The vCenter version. 3.9.0
https Boolean 3.9.0
state String 3.9.0
status String 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0

SDK Sample

Java SDK
QueryVCenterAction action = new QueryVCenterAction();
action.conditions = asList("uuid=70118e1db5084255a0e44c7af24d57b7");
action.sessionId = "10dbde6695b74150878bec7cbe97eda5";
QueryVCenterAction.Result res = action.call();
Python SDK
QueryVCenterAction action = QueryVCenterAction()
action.conditions = ["uuid=4e5f668c85be4bb4a1b5990611ad806b"]
action.sessionId = "708e5e17b29a4527a8480faadd49fdbc"
QueryVCenterAction.Result res = action.call()

DeleteVCenter

API Request

URLs
DELETE zstack/v1/vcenters/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth cf9047b652144c11b62e7176eef5540b" \
-X DELETE http://localhost:8080/zstack/v1/vcenters/cd00a732974e4ca99886338bac41d511?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The vCenter UUID. 0.6
deleteMode String url Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
DeleteVCenterAction action = new DeleteVCenterAction();
action.uuid = "17ab65db07b04666ad8eef6158e7532f";
action.deleteMode = "Permissive";
action.sessionId = "e8e3599ce54c41a4b5ff3322d2479844";
DeleteVCenterAction.Result res = action.call();
Python SDK
DeleteVCenterAction action = DeleteVCenterAction()
action.uuid = "f516dab538a64c5a9f0f2a55141ae439"
action.deleteMode = "Permissive"
action.sessionId = "aca4acf373b04a2fb1ad1112f540b1b3"
DeleteVCenterAction.Result res = action.call()

UpdateVCenter

API Request

URLs
PUT zstack/v1/vcenters/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateVCenter": {
    "name": "Test-VCenter",
    "description": "Test-Description",
    "username": "Test-Username",
    "password": "Test-Password",
    "domainName": "Test-DomainName",
    "port": 443
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVCenter":{"name":"Test-VCenter","description":"Test-Description","username":"Test-Username","password":"Test-Password","domainName":"Test-DomainName","port":443.0}}' \
http://localhost:8080/zstack/v1/vcenters/08a6059f054a3866abf6302b6461e340/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.3.2
name String body (contained in the updateVCenter structure) Optional. The resource name. 2.3.2
description String body (contained in the updateVCenter structure) Optional. The detailed description of the resource. 2.3.2
username String body (contained in the updateVCenter structure) Optional. 2.3.2
password String body (contained in the updateVCenter structure) Optional. 2.3.2
domainName String body (contained in the updateVCenter structure) Optional. 2.3.2
port Integer body (contained in the updateVCenter structure) Optional. 2.3.2
state String body (contained in the updateVCenter structure) Optinal. VCenter Enable Status. 4.8.0
systemTags List body Optional. The system tags. 2.3.2
userTags List body Optional. The user tags. 2.3.2

API Response

Sample Response
{
  "inventory": {
    "uuid": "6c42846814243c408a225e3738a2440f",
    "name": "Test-VCenter",
    "description": "Test-Description",
    "domainName": "Test-DomainName",
    "userName": "Test-Username",
    "password": "Test-Password"
  }
}
Name Type Description Starting Version
success boolean 4.8.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3.2
inventory VCenterInventory See inventory. 2.3.2
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
domainName String 0.6
port Integer 0.6
userName String 0.6
zoneUuid String The zone UUID. 0.6
https Boolean 0.6
state String 0.6
status String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK
UpdateVCenterAction action = new UpdateVCenterAction();
action.uuid = "08a6059f054a3866abf6302b6461e340";
action.name = "Test-VCenter";
action.description = "Test-Description";
action.username = "Test-Username";
action.password = "Test-Password";
action.domainName = "Test-DomainName";
action.port = 443;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVCenterAction.Result res = action.call();
Python SDK
UpdateVCenterAction action = UpdateVCenterAction()
action.uuid = "08a6059f054a3866abf6302b6461e340"
action.name = "Test-VCenter"
action.description = "Test-Description"
action.username = "Test-Username"
action.password = "Test-Password"
action.domainName = "Test-DomainName"
action.port = 443
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVCenterAction.Result res = action.call()

SyncVCenter

API Request

URLs
PUT zstack/v1/vcenters/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncVCenter": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncVCenter":{}}' \
http://localhost:8080/zstack/v1/vcenters/ada8b8f96b3033bc9420c13bba7d51b9/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The vCenter UUID. 2.2
systemTags List body Optional. The system tags. 2.2
userTags List body Optional. The user tags. 2.2

API Response

Sample Response
{
  "skippedResources": {
    "vmInstances": [
      {
        "uuid": "example",
        "name": "exampleVm"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean 4.5.3
skippedResources SkippedResources For more information, see skippedResources. 4.5.3
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.5.3
#skippedResources
Name Type Description Starting Version
vmInstances Set For more information, see vmInstances. 4.5.3
#vmInstances
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
name String The resource name. 4.5.3
description String Optional. The detailed description of the resource. 4.5.3
zoneUuid String The zone UUID. 4.5.3
clusterUuid String The cluster UUID. 4.5.3
imageUuid String The image UUID. 4.5.3
hostUuid String The host UUID. 4.5.3
lastHostUuid String 4.5.3
instanceOfferingUuid String The instance offering UUID. 4.5.3
rootVolumeUuid String The root volume UUID. 4.5.3
platform String 4.5.3
architecture String The architecture type. 4.5.3
defaultL3NetworkUuid String 4.5.3
type String 4.5.3
hypervisorType String 4.5.3
memorySize Long 4.5.3
cpuNum Integer 4.5.3
cpuSpeed Long 4.5.3
allocatorStrategy String 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
state String 4.5.3
guestOsType String The operating system type. 4.5.3
vmNics List For more information, see vmNics. 4.5.3
allVolumes List For more information, see allVolumes. 4.5.3
vmCdRoms List For more information, see vmCdRoms. 4.5.3
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
vmInstanceUuid String The VM instance UUID. 4.5.3
l3NetworkUuid String The L3 network UUID. 4.5.3
ip String The IP address. 4.5.3
mac String The MAC address. 4.5.3
hypervisorType String The hypervisor type. 4.5.3
netmask String The sub network mask. 4.5.3
gateway String The gateway. 4.5.3
metaData String 4.5.3
ipVersion Integer The IP address. 4.5.3
deviceId Integer The device ID. 4.5.3
type String The NIC type. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
usedIps List For more information, see usedIps. 4.5.3
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
ipRangeUuid String The IP range UUID. 4.5.3
l3NetworkUuid String The L3 network UUID. 4.5.3
ipVersion Integer The IP version. 4.5.3
ip String The IP address. 4.5.3
netmask String The network mask. 4.5.3
gateway String The gateway address 4.5.3
usedFor String 4.5.3
ipInLong long 4.5.3
vmNicUuid String The UUID of the VM instance NIC. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
name String The resource name. 4.5.3
description String Optional. The detailed description of the resource. 4.5.3
primaryStorageUuid String The primary storage UUID. 4.5.3
vmInstanceUuid String The VM instance UUID. 4.5.3
diskOfferingUuid String The disk offering UUID. 4.5.3
rootImageUuid String The root image UUID. 4.5.3
installPath String The mount path of the volume on the primary storage. 4.5.3
type String The volume type, including data volume and root volume. 4.5.3
format String The volume format. 4.5.3
size Long The volume size. 4.5.3
actualSize Long The volume actual size. 4.5.3
deviceId Integer 4.5.3
state String The running state of the volume. 4.5.3
status String The ready status of the volume. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp Th last operation time. 4.5.3
isShareable Boolean The sharing mode of the volume. 4.5.3
volumeQos String The volume QoS. Syntax sample: total=1048576 4.5.3
#vmCdRoms
Name Type Description Starting Version
uuid String The resource UUID. 4.5.3
vmInstanceUuid String The VM instance UUID. 4.5.3
deviceId Integer The drive sequence number. 4.5.3
isoUuid String The ISO image UUID. 4.5.3
isoInstallPath String The mount path of the ISO image. 4.5.3
name String The resource name. 4.5.3
description String Optional. The detailed description of the resource. 4.5.3
createDate Timestamp The creation time. 4.5.3
lastOpDate Timestamp The last operation time. 4.5.3
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.5.3
description String The brief description of the error. 4.5.3
details String The details about the error. 4.5.3
elaboration String The reserved field. Default value: null. 4.5.3
opaque LinkedHashMap The reserved field. Default value: null. 4.5.3
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.5.3

SDK Sample

Java SDK
SyncVCenterAction action = new SyncVCenterAction();
action.uuid = "ada8b8f96b3033bc9420c13bba7d51b9";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVCenterAction.Result res = action.call();
Python SDK
SyncVCenterAction action = SyncVCenterAction()
action.uuid = "ada8b8f96b3033bc9420c13bba7d51b9"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncVCenterAction.Result res = action.call()

QueryVCenterCluster

API Request

URLs
GET zstack/v1/vcenters/clusters
GET zstack/v1/vcenters/clusters/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b4ad190088e14bb89ad9594fd311a9b9" \
-X GET http://localhost:8080/zstack/v1/vcenters/clusters?q=uuid=82019f6ef752427480de4812339149bd
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e2545e88cc674f52bb6d9dd3954e8ea7" \
-X GET http://localhost:8080/zstack/v1/vcenters/clusters/ccf3e1c048d84ebbad90802a7bd0907c

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVCenterCluster, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "vCenterUuid": "c5198b0ec6b0364297a3c42b195c3e31",
      "morval": "Test-morval",
      "dataCenterUuid": "96dfe6e8f3ba3b159c3531cd3d50d298",
      "name": "Test-name",
      "uuid": "d76f19f8e136386b815be9839a100b1c",
      "description": "Test-description",
      "state": "Enabled",
      "hypervisorType": "ESX",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "zoneUuid": "ecd7aeb8347d3fca8e3f455da531e4f1",
      "type": "vmware"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.9.0
inventories List See inventories. 3.9.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.9.0
#inventories
Name Type Description Starting Version
vCenterUuid String The vCenter UUID. 3.9.0
dataCenterUuid String The data center UUID. 3.9.0
morval String The morval. 3.9.0
name String The resource name. 3.9.0
uuid String The resource UUID. 3.9.0
description String The detailed description of the resource. 3.9.0
state String The state. 3.9.0
hypervisorType String The hypervisor type. 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
zoneUuid String The zone UUID. 3.9.0
type String The cluster type. 3.9.0

SDK Sample

Java SDK
QueryVCenterClusterAction action = new QueryVCenterClusterAction();
action.conditions = asList("uuid=1197f1e666b24da9b96ca15b76d23029");
action.sessionId = "833bf9348c13481792af75ade4d2d0fb";
QueryVCenterClusterAction.Result res = action.call();
Python SDK
QueryVCenterClusterAction action = QueryVCenterClusterAction()
action.conditions = ["uuid=99e19ea5de35490f8f78f2b2c54e867b"]
action.sessionId = "bbfbeaea067840879cbc285146514152"
QueryVCenterClusterAction.Result res = action.call()

QueryVCenterPrimaryStorage

API Request

URLs
GET zstack/v1/vcenters/primary-storage
GET zstack/v1/vcenters/primary-storage/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 0d623b631fd7402d83b9ff2b25bdd831" \
-X GET http://localhost:8080/zstack/v1/vcenters/primary-storage?q=uuid=981850c9581d4ffb9df096112f902031
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c9d5f42a19d745c6928da0cd5325e1d6" \
-X GET http://localhost:8080/zstack/v1/vcenters/primary-storage/d51815cfb0974e168f18578618474f75

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVCenterPrimaryStorage, and pressing the Tab key.

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
QueryVCenterPrimaryStorageAction action = new QueryVCenterPrimaryStorageAction();
action.conditions = asList("uuid=252afc9b92b34337adda34baa66f41c4");
action.sessionId = "0574d9e353cb434cb8873871d6c312ba";
QueryVCenterPrimaryStorageAction.Result res = action.call();
Python SDK
QueryVCenterPrimaryStorageAction action = QueryVCenterPrimaryStorageAction()
action.conditions = ["uuid=9fad4c72758b46d38c0866e460ef4b46"]
action.sessionId = "ceba885251524d33a45220db9b465a9e"
QueryVCenterPrimaryStorageAction.Result res = action.call()

QueryVCenterBackupStorage

API Request

URLs
GET zstack/v1/vcenters/backup-storage
GET zstack/v1/vcenters/backup-storage/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 7ef3836bac52419aad77c40b44fffb75" \
-X GET http://localhost:8080/zstack/v1/vcenters/backup-storage?q=uuid=5557b285420b48b0b8c9bcea75b8b118
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 5176427af8404b40b3fdc2faa26790d1" \
-X GET http://localhost:8080/zstack/v1/vcenters/backup-storage/59ca8b1caccf41eca787b0fbd354bde9

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVCenterBackupStorage, and pressing the Tab key.

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
QueryVCenterBackupStorageAction action = new QueryVCenterBackupStorageAction();
action.conditions = asList("uuid=7557d599e0204b11b4dbf0d1dca47218");
action.sessionId = "76854653db20477199d441bc07a74552";
QueryVCenterBackupStorageAction.Result res = action.call();
Python SDK
QueryVCenterBackupStorageAction action = QueryVCenterBackupStorageAction()
action.conditions = ["uuid=ea80ba3ee9de4938a148d5b29fdc1780"]
action.sessionId = "365e725adbea460b9352adf7848a7026"
QueryVCenterBackupStorageAction.Result res = action.call()

QueryVCenterResourcePool

API Request

URLs
GET zstack/v1/vcenters/clusters/resourcepools
GET zstack/v1/vcenters/clusters/resourcepools/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vcenters/clusters/resourcepools?q=uuid=a52728c900cc3000990c379962d72eaf
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vcenters/clusters/resourcepools/06c28743a1523c7285d6782624bf93ad

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVCenterResourcePool, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "7b2495fb762a3e539d078fa6339523e3",
      "vCenterClusterUuid": "3cbf58119aaa3d9e9aa12011070e1055",
      "name": "resource-pool-1",
      "morVal": "Mor-Val-1",
      "CPULimit": 1.0E9,
      "CPUOverheadLimit": -1.0,
      "CPUReservation": 5.0E8,
      "CPUShares": 1000.0,
      "CPULevel": "green",
      "memoryLimit": 1.073741824E9,
      "memoryOverheadLimit": -1.0,
      "memoryReservation": 5.24288E8,
      "memoryShares": 1000.0,
      "memoryLevel": "green",
      "subResources": [
        {
          "uuid": "4b271fc9805638f2bd95e826376ba7e7",
          "vCenterResourcePoolUuid": "7b2495fb762a3e539d078fa6339523e3",
          "resourceUuid": "8ba5ebb4c49d378982190f2e0ec93001",
          "resourceType": "VmInstanceVO"
        }
      ]
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.3.0
inventories List See inventories. 3.3.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.3.0
description String The brief description of the error. 3.3.0
details String The details about the error. 3.3.0
elaboration String The reserved field. Default value: null. 3.3.0
opaque LinkedHashMap The reserved field. Default value: null. 3.3.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.3.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.3.0
vCenterClusterUuid String 3.3.0
name String The resource name. 3.3.0
morVal String 3.3.0
parentUuid String 3.3.0
CPULimit Long 3.3.0
CPUOverheadLimit Long 3.3.0
CPUReservation Long 3.3.0
CPUShares Long 3.3.0
CPULevel String 3.3.0
memoryLimit Long 3.3.0
memoryOverheadLimit Long 3.3.0
memoryReservation Long 3.3.0
memoryShares Long 3.3.0
memoryLevel String 3.3.0
createDate Timestamp The creation date. 3.3.0
lastOpDate Timestamp The last operation date. 3.3.0
subResources List See subResources. 3.3.0
#subResources
Name Type Description Starting Version
uuid String The resource UUID. 3.3.0
vCenterResourcePoolUuid String 3.3.0
resourceUuid String 3.3.0
resourceType String 3.3.0
createDate Timestamp The creation date. 3.3.0
lastOpDate Timestamp The last operation date. 3.3.0

SDK Sample

Java SDK
QueryVCenterResourcePoolAction action = new QueryVCenterResourcePoolAction();
action.conditions = asList("uuid=0a60a64e4bdf3dc2b4df3ac7b60a9824");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVCenterResourcePoolAction.Result res = action.call();
Python SDK
QueryVCenterResourcePoolAction action = QueryVCenterResourcePoolAction()
action.conditions = ["uuid=f73ce0f7806a3a39a9119a4b38bd44e5"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVCenterResourcePoolAction.Result res = action.call()
API Reference | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center