Get Virtualizor

OS Template

Use OS Template API to reinstall VPS with new OS template.

HTTP Request

https://hostname:4083/index.php?act=ostemplate&svs=VPSID

Parameters

NameTypeValueDescriptionRequired
actGETostemplateThe action which will return data belonging to a particular pageYes
svsPOSTVPSIDProvide vpsid of which you want the information.Yes
newosPOSTintProvide OS Template ID that you want to install on VPS.No
newpassPOSTtextProvide password of the reinstalled VPS.No

Note: If you will not provide newos and newpass than it will return all available templates.

Sample Code

PHP

<?php
    require_once('./virt/virtualizor/sdk/enduser.php');
	
    $host_ip  = 'kvm.nuftp.com';
    $key      = '4CAOZECAC3MJHMAM';
    $key_pass = 'b5s52pkfqlsn3c9jlvtt4zdkevuatfne';
    $v = new Virtualizor_Enduser_API($host_ip, $key, $key_pass);
	
	$vid = 6710;//vps id
	$newosid = 334;
	$newpass= 'test@1234';
	$vps = $v->ostemplate($vid,$newosid,$newpass);
	
    print_r(json_encode($vps));
?>

For curl the newpass and conf parameter should have same password.

Curl

curl -k -X POST -d "reinsos=Reinstall&newos=334&newpass=password&conf=password" -L "https://hostname:4083/index.php?act=ostemplate&svs=6710&api=json&apikey=your_api_key&apipass=your_api_pass"

Output

{
   "uid":"600",
   "act":"ostemplate",
   "timezone":2,
   "timenow":"July 24, 2019, 2:44 pm",
   "vpsid":6710,
   "username":"a@a.com",
   "user_type":"2",
   "preferences":{
      "theme":"default",
      "language":"english",
      "timezone":2
   },
   "url":"index.php?",
   "rdns":{
      "pdnsid":null
   },
   "support_link":"http:\/\/softaculous.com",
   "enable_eu_iso":1,
   "billing_symbol":"$",
   "enable_registration":0,
   "inhouse_billing":"0",
   "title":"KVMTestServer",
   "done":{
      "msg":"The OS reinstall process has been started in the background",
      "goto":"act=vpsmanage&svs=6710"
   },
   "oslist":{
      "kvm":{
         "centos":{
            "334":{
               "osid":"334",
               "type":"kvm",
               "name":"centos-7.0-x86_64",
               "filename":"centos-7.0-x86_64.img",
               "size":"1291845632",
               "pygrub":"0",
               "drive":"",
               "hvm":"0",
               "perf_ops":"1",
               "active":"1",
               "url":"http:\/\/files.virtualizor.com\/ostemplates.php?osid=334",
               "distro":"centos",
               "Nvirt":"kvm"
            },
         },
         "fedora":{
            "390":{
               "osid":"390",
               "type":"kvm",
               "name":"fedora-21-x86_64",
               "filename":"fedora-21-x86_64.img",
               "size":"1074855936",
               "pygrub":"0",
               "drive":"",
               "hvm":"0",
               "perf_ops":"1",
               "active":"1",
               "url":"http:\/\/files.virtualizor.com\/ostemplates.php?osid=390",
               "distro":"fedora",
               "Nvirt":"kvm"
            },
         },
      },
   },
   "virt":"kvm",
   "distros":{
      "centos":{
         "distro":"centos",
         "name":"CentOS",
         "desc":"CentOS is an Enterprise-class Linux Distribution derived from sources freely provided to the public by a prominent North American Enterprise Linux vendor.\r\n<br \/>\r\n<br \/>\r\nCentOS conforms fully with the upstream vendors redistribution policy and aims to be 100% binary compatible. CentOS mainly changes packages to remove upstream vendor branding and artwork.  \r\n<br \/>\r\n<br \/>\r\nCentOS is developed by a small but growing team of core developers. CentOS is free.",
         "logo":"",
         "screenshot":"",
         "permanent":1
      },
   },
   "info":{
      "flags":{
         "os_format_primary":true
      }
   },
   "time_taken":"0.111"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list