Welcome Guest. Please Login or Register  


You are here: Index > Virtualizor - Virtual Server Control Panel > General Support > Topic : API is not working



Threaded Mode | Print  

 API is not working, I cannot list VPS servers via API (3 Replies, Read 6972 times)
TopKenzo
Group: Member
Post Group: Newbie
Posts: 17
Status:
Hello, i'm trying to integrate Virtualizor with a commercial billing software and every time i use the API, the output is "false".

Why? All data from  the API is 100% correct and when i try to use the API via direct link opening it is working.


PHP Code

 $key =  'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$pass 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$ip 'censored IP';

require(
$_SERVER['DOCUMENT_ROOT'].'/content/addons/Virtualizor/API/admin.php');

                
$admin = new Virtualizor_Admin_API($ip$key$pass);

                
$page 0;
                
$reslen 0;
                
//For Searching
                
$post = array();
                
$post['vpsid'] = '';
                
$post['vpsname'] = '';
                
$post['vpsip'] = '';
                
$post['vpshostname'] = '';
                
$post['vsstatus'] = '';
                
$post['vstype'] = '';
                
$post['speedcap'] = '';
                
$post['user'] = '';
                
$post['vsgid'] = '';
                
$post['vserid'] = '';
                
$post['plid'] = '';
                
$post['bpid'] = '';
                
$post['serid'] = '';
                
$post['search'] = '';

                
$output $admin->listvs($page ,$reslen ,$post);

                
print_r(json_encode($output)); // RETURNS "false" 

IP: --   

API is not working
virtualizor-manager
Group: Virtualizor Team
Post Group: Newbie
Posts: 3
Status:
Hi,
try this code it should work

$key =  'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$pass = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$ip = 'censored IP';

require($_SERVER['DOCUMENT_ROOT'].'/content/addons/Virtualizor/API/admin.php');

                $admin = new Virtualizor_Admin_API($ip, $key, $pass);

                $output = $admin->listvs();

                print_r(json_encode($output));

//if you will just use listvs it will be fine no need to pass $post, $page, $reslen by default page is 0 and reslen i.e. the result length(number of vps to return) is 50 if you want to search vps than only pass $post
//also check if the api key and pass you provide is correct
IP: --   

API is not working
TopKenzo
Group: Member
Post Group: Newbie
Posts: 17
Status:
Already tried this, same.
IP: --   

API is not working
urgido
Group: Member
Post Group: Newbie
Posts: 31
Status:
same issue here
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is March 28, 2024, 10:19 pm.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.029