Skip to content

vm.php

Virtual Machine (VM) management module providing an API for creating, retrieving, deleting, and restoring snapshots, as well as loading statistics.

API Methods

Method Action Description
create_snapshot create snapshot Creates a new snapshot of the specified virtual machine.
get_snapshot get snapshot Retrieves information about a specific VM snapshot by its ID.
load_stats get vm stats Loads statistical information for a specific virtual machine or server group.
remove_snapshot remove snapshot Removes a specific snapshot from the virtual machine.
restore_snapshot restore snapshot Restores a virtual machine to a previously saved snapshot state.
update_restore_settings update restore settings Updates the restoration configuration settings for a specific virtual machine.

vm/create_snapshot

Creates a new snapshot of the specified virtual machine.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action ✅ string The action to perform (create_snapshot)
token ✅ string Authentication token for API access
id ❌ int ID of the virtual machine for which the snapshot will be created

Example Request

curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "action=create_snapshot" \
--data "token=YOUR_TOKEN" \
--data "id=123"
Example of a successful response
{
"result": "OK",
"action": "create_snapshot",
"callback": "7bc29eb23b1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "Action required"
}

vm/get_snapshot

Retrieves information about a specific VM snapshot by its ID.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action ✅ string The action to perform (get_snapshot)
token ✅ string Authentication token for the request
id ✅ integer The ID of the snapshot to retrieve
type ✅ string Parameter type (detected in code)

Example Request

curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "action=get_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=123" \
--data "type=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_snapshot",
"data": {
"id": 123,
"name": "pre-update-backup",
"created_at": "2024-05-20T14:30:00Z",
"size_gb": 20,
"status": "active"
}
}
Failure response
{
"code": -1,
"message": "Snapshot not found"
}

vm/load_stats

Loads statistical information for a specific virtual machine or server group.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action ✅ string The action to perform (load_stats)
token ✅ string Authentication token
id ❌ integer ID of the virtual machine or server

Example Request

curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "action=load_stats" \
--data "token=HOSTKEY_TOKEN" \
--data "id=123"
Example of a successful response
{
"result": "OK",
"action": "load_stats",
"data": {
"cpu_usage": 15.5,
"ram_usage": 2048,
"disk_io": 120.5,
"network_in": 500.2,
"network_out": 350.8,
"uptime": "2 days, 4 hours",
"status": "active"
}
}
Failure response
{
"code": -1,
"message": "$module: action required"
}

vm/remove_snapshot

Removes a specific snapshot from the virtual machine.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action ✅ string The action to perform (remove_snapshot)
token ✅ string Authentication token for API access
id ✅ int ID of the resource or VM

Example Request

curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "action=remove_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Example of a successful response
{
"result": "OK",
"action": "remove_snapshot",
"callback": "7bc29eb23b1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "Access denied"
}

vm/restore_snapshot

Restores a virtual machine to a previously saved snapshot state.

HTTP Method: POST

Parameters:

Parameter Required Type Description
token ✅ string Authentication token for the request
id ❌ int The ID of the virtual machine or snapshot to restore

Example Request

curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "token=HOSTKEY_TOKEN" \
--data "id=123"
Example of a successful response
{
"result": "OK",
"action": "restore_snapshot",
"callback": "7bc29eb23b1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "Action required or invalid token"
}

vm/update_restore_settings

Updates the restoration configuration settings for a specific virtual machine.

HTTP Method: POST

Parameters:

Parameter Required Type Description
token ✅ string Authentication token
id ✅ int The ID of the virtual machine
type ✅ string Parameter type (detected in code)
enable_rotation ✅ boolean Whether to enable rotation
exclude_rotation ✅ array List of IDs to exclude from rotation

Example Request

curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "token=HOSTKEY_TOKEN" \
--data "id=123" \
--data "type=VALUE" \
--data "enable_rotation=true" \
--data "exclude_rotation[]=101" \
--data "exclude_rotation[]=102"
Example of a successful response
{
"result": "OK",
"action": "update_restore_settings",
"data": {
"status": "success",
"message": "Settings updated successfully"
},
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "Invalid token or insufficient permissions"
}
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×