ZStack 3.10.0>API Reference>vCenter

vCenter


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"   } }
Name Type Description Starting Version
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
#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
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()







Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.