GET zstack/v1/hosts GET zstack/v1/hosts/{uuid}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 99a86d711f154752b52a7de2b3c43a63" \ -X GET http://localhost:8080/zstack/v1/hosts?q=uuid=66547f0fc9fd45d98f6b8482488f2993
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth bd46777b8a8c4616a64f0cdbcf1bf98e" \ -X GET http://localhost:8080/zstack/v1/hosts/bb582f21cfad4f61a2ab1ec062131b4a
Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryHost
, and pressing the Tab key.
{ "inventories": [ { "zoneUuid": "37649b12f572303a883c19c4c7af0856", "name": "example", "uuid": "f7bae73b9874344b8766dfcdda48ad6e", "clusterUuid": "d59c027b81fe3bbc9d78ef45f574febb", "description": "example", "managementIp": "192.168.0.1", "hypervisorType": "KVM", "state": "Enabled", "status": "Connected", "totalCpuCapacity": 4.0, "availableCpuCapacity": 2.0, "cpuSockets": 4.0, "totalMemoryCapacity": 1840414720, "availableMemoryCapacity": 1840414720, "cpuNum": 4.0 } ] }
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 |
inventories | List | See inventories. | 0.6 |
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 |
Name | Type | Description | Starting Version |
---|---|---|---|
zoneUuid | String | The zone UUID. | 0.6 |
name | String | The resource name. | 0.6 |
uuid | String | The resource UUID. | 0.6 |
clusterUuid | String | The cluster UUID. | 0.6 |
description | String | The detailed description of the resource. | 0.6 |
managementIp | String | 0.6 | |
hypervisorType | String | 0.6 | |
state | String | The host state, including:
| 0.6 |
status | String | The host status, including:
| 0.6 |
totalCpuCapacity | Long | 0.6 | |
availableCpuCapacity | Long | 0.6 | |
cpuSockets | Integer | 0.6 | |
totalMemoryCapacity | Long | 0.6 | |
availableMemoryCapacity | Long | 0.6 | |
cpuNum | Integer | 0.6 | |
createDate | Timestamp | The creation date. | 0.6 |
lastOpDate | Timestamp | The last operation date. | 0.6 |
QueryHostAction action = new QueryHostAction(); action.conditions = asList("uuid=fb0510cd5bf04565be44c43da20169c7"); action.sessionId = "d69767ca64854cfb99960282fcdb8aed"; QueryHostAction.Result res = action.call();
QueryHostAction action = QueryHostAction() action.conditions = ["uuid=2ddc05f8f46b4d5ab40053fdb72ae69d"] action.sessionId = "96b183220af446c39d7cf2674761d85e" QueryHostAction.Result res = action.call()
URLs
DELETE zstack/v1/hosts/{uuid}?deleteMode={deleteMode}
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 999c480f7f344c3b803c3d74b82b7145" \ -X DELETE http://localhost:8080/zstack/v1/hosts/bb2e5125ac2c4b3680463d7aeaf57773?deleteMode=Permissive
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 0.6 | |
deleteMode | String | body | 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 |
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" } }
DeleteHostAction action = new DeleteHostAction(); action.uuid = "2d4b91d9831d4630bf113ea75f78cb7a"; action.deleteMode = "Permissive"; action.sessionId = "923c9089a5fd4ea5b9fbfc1dec5802e2"; DeleteHostAction.Result res = action.call();
Python SDK
DeleteHostAction action = DeleteHostAction() action.uuid = "f62a37111c154ec9afeaeb2700ebcfe6" action.deleteMode = "Permissive" action.sessionId = "2aa7f575d8654712ba985f4a36594f0a" DeleteHostAction.Result res = action.call()
PUT zstack/v1/hosts/{uuid}/actions
Authorization: OAuth the-session-uuid
{ "updateHost": { "name": "example", "description": "example", "managementIp": "192.168.0.1" }, "systemTags": [], "userTags": [] }
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X PUT -d '{"updateHost":{"name":"example","description":"example","managementIp":"192.168.0.1"}}' \ http://localhost:8080/zstack/v1/hosts/fe98e821991a3c96af96fc7e458d2020/actions
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 0.6 | |
name | String | body (contained in the updateHost structure) | Optional. The resource name. | 0.6 | |
description | String | body (contained in the updateHost structure) | Optional. The detailed description of the resource. | 0.6 | |
managementIp | String | body (contained in the updateHost structure) | Optional. The IP address of the management node. | 0.6 | |
systemTags | List | body | Optional. The system tags. | 0.6 | |
userTags | List | body | Optional. The user tags. | 0.6 |
{ "inventory": { "zoneUuid": "2adef89f417e40dbab643656bbdc6eab", "name": "example", "uuid": "aaeb1d3c1f5a43fd941bfebab10b9f34", "clusterUuid": "c12dec3c77e34c40a86c4ceea02b860b", "description": "example", "managementIp": "192.168.0.1", "hypervisorType": "KVM", "state": "Enabled", "status": "Connected", "totalCpuCapacity": 4.0, "availableCpuCapacity": 2.0, "totalMemoryCapacity": 4.0, "availableMemoryCapacity": 4.0 } }
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 | HostInventory | See inventory. | 0.6 |
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 |
Name | Type | Description | Starting Version |
---|---|---|---|
zoneUuid | String | The zone UUID. | 0.6 |
name | String | The resource name. | 0.6 |
uuid | String | The resource UUID. | 0.6 |
clusterUuid | String | The cluster UUID. | 0.6 |
description | String | The detailed description of the resource. | 0.6 |
managementIp | String | 0.6 | |
hypervisorType | String | 0.6 | |
state | String | 0.6 | |
status | String | 0.6 | |
totalCpuCapacity | Long | 0.6 | |
availableCpuCapacity | Long | 0.6 | |
cpuSockets | Integer | 0.6 | |
totalMemoryCapacity | Long | 0.6 | |
availableMemoryCapacity | Long | 0.6 | |
cpuNum | Integer | 0.6 | |
createDate | Timestamp | The creation date. | 0.6 |
lastOpDate | Timestamp | The last operation date. | 0.6 |
UpdateHostAction action = new UpdateHostAction(); action.uuid = "17aa30b0eb5849fca56804ddd5050c84"; action.name = "example"; action.description = "example"; action.managementIp = "192.168.0.1"; action.sessionId = "f303f20ae5b740468f56e8007acba81c"; UpdateHostAction.Result res = action.call();
UpdateHostAction action = UpdateHostAction() action.uuid = "3925f7e788b54e86831644a6f85ea7c7" action.name = "example" action.description = "example" action.managementIp = "192.168.0.1" action.sessionId = "83a1c2866a8a42f98c66ed7196a58d75" UpdateHostAction.Result res = action.call()
Back to Top
Email Us
contact@zstack.ioEmail Us
contact@zstack.ioEmail Us
contact@zstack.ioThe 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.Thank you for using ZStack products and services.
Submit successfully.
We'll connect soon.Thank you for using ZStack products and services.