Skip to content

Vm

API Methods

Method Action Description
create_snapshot create snapshot Initiates the creation of a snapshot for the specified virtual machine. Returns a task key for status tracking.
get_snapshot get snapshot list Returns a list of snapshots and settings for the specified virtual machine.
load_stats load statistics Initiates the loading of resource usage statistics for the virtual machine.
remove_snapshot remove snapshot Initiates the deletion of a snapshot with the specified name.
restore_snapshot restore snapshot Initiates the restoration of the virtual machine state from a snapshot.
update_restore_settings update restore settings Updates automatic restore and snapshot rotation settings for the specified virtual machine.

vm/create_snapshot

Initiates the creation of a snapshot for the specified virtual machine. Returns a task key for status tracking.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_snapshot
token string User authorization token
id int Unique identifier of the virtual machine
name string Snapshot name (allowed characters: a-zA-Z0-9_-.)
type string Snapshot type (default: 'snapshot')
num_rotation int Number of snapshot rotations (optional, value is ignored in the current implementation)

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"
}

vm/get_snapshot

Returns a list of snapshots and settings for the specified virtual machine.

HTTP Method: POST

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 POST \
--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",
"settings": {
"num_rotation": 5,
"type": "snapshot"
}
}
Failure response
{
"code": -1,
"message": "failed to request snapshots list for $id"
}

vm/load_stats

Initiates the loading of resource usage statistics for the 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 a snapshot with the specified name.

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 Name of the snapshot to remove
type string Snapshot type (default: 'snapshot')
openstack_id string Snapshot identifier in OpenStack

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"
}

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 Name of the snapshot to restore
type string Snapshot type (default: 'snapshot')
openstack_id string Snapshot identifier in OpenStack

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"
}

vm/update_restore_settings

Updates automatic restore and snapshot rotation settings for the specified virtual machine.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: update_restore_settings
token string User authorization token
id int Unique identifier of the virtual machine
type string Snapshot type (default: snapshot)
enable_rotation int Enable snapshot rotation (1 - yes, 0 - no)
exclude_rotation[] array<string> Array of snapshot names to exclude from rotation

Example Request

curl -s "https://api.hostkey.com/vm.php" -X POST \
--data "action=update_restore_settings" \
--data "token=HOSTKEY_TOKEN" \
--data "id=12345" \
--data "type=snapshot" \
--data "enable_rotation=1" \
--data "exclude_rotation[]=backup_1" \
--data "exclude_rotation[]=backup_2"
Example of a successful response
{
"result": "OK",
"module": "vm",
"action": "update_restore_settings"
}
Failure response
{
"code": -1,
"message": "authentication required"
}

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