Skip to content

Vm

API Methods

Method Action Description
create_snapshot create snapshot Initiates the creation of a snapshot for the specified virtual machine.
get_snapshot get snapshot list Requests the list of existing snapshots for a virtual machine.
load_stats load statistics Requests the current resource usage statistics for a virtual machine.
remove_snapshot remove snapshot Initiates the deletion of the specified snapshot.
restore_snapshot restore snapshot Initiates the restoration of the virtual machine state from a snapshot.

vm/create_snapshot

Initiates the creation of a snapshot for the specified virtual machine.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_snapshot
token string Authorization token
id int Virtual machine identifier
name string Snapshot name (characters a-zA-Z0-9_-.)
type string Snapshot type (default 'snapshot')

Example Request

curl -s "https://api.hostkey.com/vm.php" -X POST \
--data "action=create_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "name=VALUE"
Example of a successful response
{
"result": "OK",
"module": "vm",
"action": "create_snapshot",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "failed to request snapshot creation for $id - {$skey['error']}"
}

vm/get_snapshot

Requests the list of existing snapshots for a virtual machine.

HTTP Method: GET

Parameters:

Parameter Required Type Description
action string Method identifier: get_snapshot
token string Authorization token
id int Virtual machine identifier
type string Snapshot type (default 'snapshot')

Example Request

curl -s "https://api.hostkey.com/vm.php" -X GET \
--data "action=get_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Example of a successful response
{
"result": "OK",
"module": "vm",
"action": "get_snapshot",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "failed to request snapshots list for $id"
}

vm/load_stats

Requests the current resource usage statistics for a virtual machine.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: load_stats
token string Authorization token
id int Virtual machine identifier

Example Request

curl -s "https://api.hostkey.com/vm.php" -X POST \
--data "action=load_stats" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Example of a successful response
{
"result": "OK",
"module": "vm",
"action": "load_stats",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "failed to request stats for $id"
}

vm/remove_snapshot

Initiates the deletion of the specified snapshot.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: remove_snapshot
token string Authorization token
id int Virtual machine identifier
name string Snapshot name to remove
type string Snapshot type (default 'snapshot')

Example Request

curl -s "https://api.hostkey.com/vm.php" -X POST \
--data "action=remove_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "name=VALUE"
Example of a successful response
{
"result": "OK",
"module": "vm",
"action": "remove_snapshot",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "failed to request snapshot removal for $id - {$skey['error']}"
}

vm/restore_snapshot

Initiates the restoration of the virtual machine state from a snapshot.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: restore_snapshot
token string Authorization token
id int Virtual machine identifier
name string Snapshot name to restore
type string Snapshot type (default 'snapshot')
backup_id string Additional backup identifier

Example Request

curl -s "https://api.hostkey.com/vm.php" -X POST \
--data "action=restore_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "name=VALUE"
Example of a successful response
{
"result": "OK",
"module": "vm",
"action": "restore_snapshot",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "failed to request restore from snapshot for $id - {$skey[\"error\"]}"
}

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×