Use Change Password API to change password of VPS on your server.
HTTP Request
https://hostname:4083/index.php?act=changepassword&svs=vpsid
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | changepassword | The action specified to return data | Yes |
svs | POST | Int | The vpsid whose password needs to be changed | Yes |
newpass | POST | newpass | The new password of the vps | Yes |
conf | POST | conf | Confirmation to change the password | Yes |
Sample Code
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = '';
$pass = '';
$ip = '';
$admin = new Virtualizor_Enduser_API($ip, $key, $pass);
$vid = 3384;
$newpass = 'Test123';
$output = $admin->changepassword($vid, $newpass);
print_r(json_encode($output));
?>
Curl
curl -k -X POST -d "changepass=1&newpass=test@123&conf=test@123"
-L "https://hostname:4083/index.php?act=changepassword&svs=3577&api=json&
apikey=your_api_key&apipass=your_api_pass&do=1"
Output
{
"uid": "321",
"act": "changepassword",
"timezone": 1,
"timenow": "September 23, 2016, 6:20 am",
"vpsid": "3008",
"username": "test@test.com",
"user_type": "2",
"preferences": {
"fname": "test",
"lname": "test",
"language": "english",
"theme": "default",
"timezone": 1,
"logo": ""
},
"url": "index.php?",
"rdns": {
"pdnsid": null
},
"support_link": "http://softaculous.com",
"disable_login_logo": 1,
"title": "Change Password",
"done": {
"msg": "Your password will be changed when the VPS is booted again"
},
"onboot": "Your password will be changed when the VPS is booted again",
"time_taken": "1.327"
}