VM Related Interfaces

Get Virtual Machine Hostname

GET/zstack/v1/vm-instances/{uuid}/hostnames

Get the specified hostname of a Virtual Machine. This hostname is the one set by the user through SetVmHostname.

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth: 0e3cbe22c03a43bc9b7b3ae76c57a0e7" \
-X GET http://localhost:8080/zstack/v1/vm-instances/c5c6665ccbe2444e9cfa393366cdb5d4/hostnames

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlVirtual Machine UUID 0.6
systemTags (Optional)ListquerySystem Tag 0.6
userTags (Optional)ListqueryUser Tag 0.6

API Response

Response Example

{
  "hostname": "vm1.zstack.orgl"
}
NameTypeDescriptionStarting Version
hostnameStringVirtual Machine hostname0.6
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation is successful. For details, see error0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The source error that caused the current error. If there is no original error, this field is null0.6

SDK Examples

Java SDK

GetVmHostnameAction action = new GetVmHostnameAction();
action.uuid = "82c0f5918de14f65abe7ba5d37c28502";
action.sessionId = "24f9301f25784707a477483c5702c034";
GetVmHostnameAction.Result res = action.call();

Python SDK

GetVmHostnameAction action = GetVmHostnameAction()
action.uuid = "5070e337b731448ca0698f83c7fc4c26"
action.sessionId = "f13e0ed993134a8ea35a3d382a971b14"
GetVmHostnameAction.Result res = action.call()