Document navigation

AddKVMHostFromConfigFile

API Request

URLs

POST zstack/v1/hosts/kvm/from-file

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "hostInfo": "FILE CONTENT ENCODE BY BASE64"
  },
  "systemTags": [],
  "userTags": []
}

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":{"hostInfo":"FILE CONTENT ENCODE BY BASE64"}}' http://localhost:8080/zstack/v1/hosts/kvm/from-file

Request Parameters

Name Type Location Description Optional Value Starting Version
hostInfo String body (contained in the params structure) The host information encoded in Base64 format. 3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response

{
  "results": [
    {
      "ip": "127.0.0.1",
      "success": true
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 3.1.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
results List See results. 3.1.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.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.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.1.0

#results

Name Type Description Starting Version
ip String The host IP address. 3.1.0
success boolean Whether the operation succeeded. 3.1.0
error ErrorCode See error. 3.1.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.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.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.1.0

SDK Sample

Java SDK

AddKVMHostFromConfigFileAction action = new AddKVMHostFromConfigFileAction();
action.hostInfo = "FILE CONTENT ENCODE BY BASE64";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddKVMHostFromConfigFileAction.Result res = action.call();

Python SDK

action = AddKVMHostFromConfigFileAction()
action.hostInfo = "FILE CONTENT ENCODE BY BASE64"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()