vm.php¶
VM management module for handling snapshots, statistics loading, and CPU graph generation.
API Methods¶
| Method | Action | Description |
|---|---|---|
cpu_graph | get cpu graph | Returns a base64 encoded PNG image of the CPU usage graph for the specified server. |
create_snapshot | create snapshot | Creates a new snapshot for the specified server. |
get_snapshot | get snapshot | Retrieves a list of snapshots and their settings for the specified server. |
load_stats | load stats | Requests loading of server statistics. |
remove_snapshot | remove snapshot | Removes a specific snapshot from the server. |
restore_snapshot | restore snapshot | Restores a server from a previously created snapshot. |
update_restore_settings | update restore settings | Updates the snapshot/backup rotation and exclusion settings for a server. |
vm/cpu_graph¶
Returns a base64 encoded PNG image of the CPU usage graph for the specified server.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: cpu_graph |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
Request example
Success response example
vm/create_snapshot¶
Creates a new snapshot for the specified server.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: create_snapshot |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
| params[name] | ✅ | string | Snapshot name. Must be between 5 and 30 characters and not start with reserved backup prefixes. |
| params[type] | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| params[num_rotation] | ❌ | integer | Number of rotations for snapshots. |
| type | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| num_rotation | ❌ | integer | Number of rotations for snapshots. |
| name | ✅ | string | The name of the snapshot, must be between 5 and 30 characters. |
Request example
Success response example
vm/get_snapshot¶
Retrieves a list of snapshots and their settings for the specified server.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_snapshot |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
| params[type] | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| type | ✅ | string | Type of snapshots to retrieve. Allowed values: snapshot, backup. |
Request example
Success response example
vm/remove_snapshot¶
Removes a specific snapshot from the server.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: remove_snapshot |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
| params[name] | ✅ | string | Name of the snapshot to remove. |
| params[type] | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| params[openstack_id] | ❌ | string | OpenStack identifier for the snapshot. |
| type | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| openstack_id | ❌ | string | OpenStack identifier for the snapshot. |
| name | ✅ | string | The name of the snapshot to be removed. |
Request example
Success response example
Error examples
vm/restore_snapshot¶
Restores a server from a previously created snapshot.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: restore_snapshot |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
| params[name] | ✅ | string | Name of the snapshot to restore from. |
| type | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| openstack_id | ❌ | string | OpenStack identifier for the snapshot. |
| params[type] | ❌ | string | Snapshot type. Allowed values: snapshot, backup. |
| params[openstack_id] | ❌ | string | OpenStack identifier for the snapshot. |
| name | ✅ | string | The name of the snapshot to be restored. |
Request example
curl -s "https://invapi.hostkey.com/vm.php" -X POST \
--data "action=restore_snapshot" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "params[name]=VALUE" \
--data "type=snapshot" \
--data "openstack_id=VALUE" \
--data "params[type]=snapshot" \
--data "params[openstack_id]=VALUE" \
--data "name=VALUE"
Success response example
Error examples
vm/load_stats¶
Requests loading of server statistics.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: load_stats |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
Request example
Success response example
Error examples
vm/update_restore_settings¶
Updates the snapshot/backup rotation and exclusion settings for a server.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: update_restore_settings |
| token | ✅ | string | Authentication token. |
| id | ✅ | integer | Server ID. |
| type | ❌ | string | Snapshot or backup type. Allowed values: snapshot, backup |
| enable_rotation | ❌ | boolean | Whether rotation should be enabled. |
| exclude_rotation | ❌ | array<integer> | List of snapshot/backup IDs to exclude from rotation. |
| params[type] | ❌ | string | Snapshot or backup type. Allowed values: snapshot, backup. |
| params[enable_rotation] | ❌ | boolean | Whether rotation should be enabled. |
| params[exclude_rotation] | ❌ | array<integer> | List of snapshot/backup IDs to exclude from rotation. |
Request example