General API

The API Other vm is are get requests, to manage VMs that help integrate with other applications.

General json

Url: host/api/vm/general/ vmId(90E450FE-6386-4EA0-86AA-DFE2656CB2E5)

Note!

API does not work without authorization.

Examples

PHP


header('Content-type: text/html; charset=utf-8');
require 'phpQuery.php';

$url_auth = 'http://127.0.0.1:8117/login';
$url = 'http://127.0.0.1:8117/api/vm/general/90E450FE-6386-4EA0-86AA-DFE2656CB2E5';

//authorization
$auth_data = [
    'usr' => 'administrator',
    'pwd' => 'admin',
];



function post_auth($url, $data = []){
	$ch = curl_init($url);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
	curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__ . '/cookie.txt');
	
	$res = curl_exec($ch);
	curl_close($ch);
	return $res;
}

function post_get($url){
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__ . '/cookie.txt');
	
	$res = curl_exec($ch);
	curl_close($ch);
	return $res;
}



//authorization
post_auth($url_auth, $auth_data);

//get
echo post_get($url);