Console Service Operations
RequestConsoleAccess
API Request
URLs
POST zstack/v1/consolesHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"vmInstanceUuid": "b95acae48c804003ac3820751b58a50d"
},
"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":{"vmInstanceUuid":"e0442db541833083bd7e411a4d94d969"}}' \
http://localhost:8080/zstack/v1/consolesRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | body (contained in the params structure) | The VM instance UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"scheme": "http",
"hostname": "127.0.0.1",
"port": 4900.0,
"token": "d96caf24fae54c76b7652f548a258261"
}
}#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 |
|---|---|---|---|
| scheme | String | The type of the access protocol. | 0.6 |
| hostname | String | The hostname. | 0.6 |
| port | int | The port. | 0.6 |
| token | String | The token. | 0.6 |
SDK Sample
Java
SDK
RequestConsoleAccessAction action = new RequestConsoleAccessAction();
action.vmInstanceUuid = "c8925478e1f840caa1f3919affa19155";
action.sessionId = "f896abb919754292aa8d2f286596142c";
RequestConsoleAccessAction.Result res = action.call();Python
SDK
RequestConsoleAccessAction action = RequestConsoleAccessAction()
action.vmInstanceUuid = "f37c825f87444941bf16261f63c7dbb7"
action.sessionId = "331a21749df940e4b447e9103518890d"
RequestConsoleAccessAction.Result res = action.call()QueryConsoleProxyAgent
API Request
URLs
GET zstack/v1/consoles/agents
GET zstack/v1/consoles/agents/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 350b72c2d3f24641a767acbcec744b19" \
-X GET http://localhost:8080/zstack/v1/consoles/agents?q=uuid=745b7c17cd224025b3adfef4ae61b3d2curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth bb08e240616b482984c397e4517a021c" \
-X GET http://localhost:8080/zstack/v1/consoles/agents/8a3cc2be7e20420db29925e381c598bcQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryConsoleProxyAgent, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"uuid": "c77bbc7d3364449e9543d0776a6087de",
"managementIp": "127.0.0.1",
"type": "ManagementServerConsoleProxy",
"state": "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 |
| inventories | List | See inventories. | 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 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| managementIp | String | The IP address of the management node. | 0.6 |
| type | String | The type. | 0.6 |
| status | String | The status, including Connected and Disconnected. | 0.6 |
| state | String | The state, including Enabled and Disabled. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
QueryConsoleProxyAgentAction action = new QueryConsoleProxyAgentAction();
action.conditions = asList("uuid=dfbe49d87cb94d93b69354fa1270012b");
action.sessionId = "e2300cd4f74a457e87f13842aeb8fdef";
QueryConsoleProxyAgentAction.Result res = action.call();Python
SDK
QueryConsoleProxyAgentAction action = QueryConsoleProxyAgentAction()
action.conditions = ["uuid=1e47046946f849ee871de20a2b045750"]
action.sessionId = "1655d7f2e56d4710824cd1082bd5cc94"
QueryConsoleProxyAgentAction.Result res = action.call()ReconnectConsoleProxyAgent
API Request
URLs
PUT zstack/v1/consoles/agentsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"reconnectConsoleProxyAgent": {
"agentUuids": [
"ce9f63639c6947fc9de43014a9c42af6",
"5cf200f8fa6640278ab3751a9e40a122",
"896f44bd3a2544e3b49a30dbe41303da"
]
},
"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 '{"reconnectConsoleProxyAgent":{"agentUuids":["9a00b78598253e68914541e6760ddeaa","c18fbd323fbd3902961e4105ec9364d0","96efd32908dd3f71bef8c0f414dbf828"]}}' \
http://localhost:8080/zstack/v1/consoles/agentsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| agentUuids | List | body (contained in the params structure) | Optional. The console proxy UUIDs. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"976e8d54d42841da85eb697f3e8534b6": true,
"ac4b5e3b69e5499eba381082199b5d42": true
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| inventory | Map | The console proxy inventory. | 0.6 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 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 |
SDK Sample
Java
SDK
ReconnectConsoleProxyAgentAction action = new ReconnectConsoleProxyAgentAction();
action.agentUuids = asList("9b1d2cae4e75418ba8ca00a7f8d61eee","b3c9068b99664b65851bc29e39c3e336","89ea316d7f114203bb352d22b1f878e2");
action.sessionId = "607aa9478e0f452ab3fe43f0bb44771f";
ReconnectConsoleProxyAgentAction.Result res = action.call();Python
SDK
ReconnectConsoleProxyAgentAction action = ReconnectConsoleProxyAgentAction()
action.agentUuids = [6b5d95576b444661a23454913abce886, 64326c502c4042b196d9602737733d64, 1cc5a9dbb4284fbe850e387788b365ec]
action.sessionId = "dc7db7612de24cb7a3d91d1d08b03162"
ReconnectConsoleProxyAgentAction.Result res = action.call()UpdateConsoleProxyAgent
API Request
URLs
PUT zstack/v1/consoles/agents/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateConsoleProxyAgent": {
"consoleProxyOverriddenIp": "127.0.0.1"
},
"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 '{"updateConsoleProxyAgent":{"consoleProxyOverriddenIp":"127.0.0.1"}}' \
http://localhost:8080/zstack/v1/consoles/agents/f616460f24cd330180db4188c3a905b6/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 2.3 | |
| consoleProxyOverriddenIp | String | body (contained in the updateConsoleProxyAgent structure) | The IP address of the new console proxy. | 2.3 | |
| systemTags | List | body | Optional. The system tags. | 2.3 | |
| userTags | List | body | Optional. The user tags. | 2.3 |
API Response
Sample Response
{
"inventory": {}
}#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 |
| description | String | The detailed description of the resource. | 0.6 |
| managementIp | String | The IP address of the management node. | 0.6 |
| type | String | The type. | 0.6 |
| status | String | The status, including Connected and Disconnected. | 0.6 |
| state | String | The state, including Enabled and Disabled. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
UpdateConsoleProxyAgentAction action = new UpdateConsoleProxyAgentAction();
action.uuid = "f616460f24cd330180db4188c3a905b6";
action.consoleProxyOverriddenIp = "127.0.0.1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateConsoleProxyAgentAction.Result res = action.call();Python
SDK
UpdateConsoleProxyAgentAction action = UpdateConsoleProxyAgentAction()
action.uuid = "f616460f24cd330180db4188c3a905b6"
action.consoleProxyOverriddenIp = "127.0.0.1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateConsoleProxyAgentAction.Result res = action.call()