Use the User Suspension API to suspend a particular user, by passing the user's ID. The IDs can be obtained by the list users API. A suspended user cannot access the Virtual Private Servers assigned to it. The API response will contain "done" as "true" on successful suspension of the user.
HTTP Request
https://hostname:4085/index.php?act=users
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | users | The action will return "done" as "true" and the list of users after suspending the user | Yes |
suspend | POST | Int | The ID of the users to be suspended. For suspending multiple users pass in the IDs as comma separated values | Yes |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$page = 1;
$reslen = 3;
$post = array();
$post['suspend'] = 60;
$post['suspend'] = '60,61'; // for suspending multiple users
$output = $admin->users($page,$reslen,$post);
print_r(json_encode($output));
?>
Output
{
"title": "Users",
"done": true,
"users": {
"55": {
"uid": "55",
"password": "",
"email": "tt@rrr.com",
"type": "0",
"aclid": "0",
"pid": "0",
"uplid": "0",
"inhouse_billing": "0",
"cur_bal": "0.00",
"cur_usage": "0.00",
"cur_invoices": "0.00",
"max_cost": "0",
"num_vs": "0",
"num_users": "0",
"space": "0",
"ram": "0",
"burst": "0",
"bandwidth": "0",
"cpu": "0",
"cores": "4",
"cpu_percent": "0",
"num_cores": "0",
"num_ipv4": "0",
"num_ipv6": "0",
"num_ipv6_subnet": "0",
"allowed_virts": "",
"network_speed": "0",
"upload_speed": "-1",
"openvz": "0",
"xen": "0",
"xenhvm": "0",
"kvm": "0",
"sg": "",
"mg": "",
"preferences": "a:2:{s:5:\"fname\";s:0:\"\";s:5:\"lname\";s:0:\"\";}",
"dnsplid": "0",
"act_status": "1",
"activation_code": "",
"date_created": "1534250148",
"service_period": "1",
"band_suspend": "0",
"billing_warn": null,
"suspended": null,
"numvps": "1",
"bw_used": "0.00"
}
},
"timenow": 1535988108,
"time_taken": "0.941"
}