We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Admin API Problems
Admin API Problems
Hi All,skid wrote:Admin API 100% ready and available via http. Use POST as request method. Here are some useful examplesCode: Select all
# Crete new user account "demo" https://server-ip:8083/api/?&user=admin&password=currentpwd&cmd=v-add-domain&arg1=demo&arg2=d3m0p4ssw0rd&[email protected] # Add domain demo.vestacp.com https://server-ip:8083/api/?&user=admin&password=currentpwd&cmd=v-add-domain&arg1=demo&arg2=demo.vestacp.com
When I try to do anything via a post request to the API I'm getting a pretty empty HTTP 200 response back from the server.
Just tried this one:
Code: Select all
https://x.x.x.x:8083/api/?&user=admin&password=makeyuppey&cmd=v-add-domain&arg1=graham&arg2=wpcp.graham.pw&arg3=146.185.129.249
Thanks
Re: Admin API Problems
Try to play with following code
Here is an example for user listing which sho
If you want to parse result instead of output then add returncode=yes to your request
Here is an example for user listing which sho
Code: Select all
<?php
// Server credentials
$server = 'your-server.vestacp.com';
$user = 'admin';
$password = '1 slice of pizza!';
// Prepare variables
$postvars = array(
'user' => $user,
'password' => $password,
'cmd' => 'v-list-users',
'arg1' => 'json'
);
$postdata = http_build_query($postvars);
// Get current status
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $server . ':8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
$results = json_decode($answer, true);
print_r($results);
?>
If you want to parse result instead of output then add returncode=yes to your request
Code: Select all
<?php
// Server credentials
$server = 'your-server.vestacp.com';
$user = 'admin';
$password = '1 slice of pizza!';
// Prepare variables
$postvars = array(
'user' => $user,
'password' => $password,
'cmd' => 'v-delete-user',
'arg1' => 'admin',
'returncode' => 'yes'
);
$postdata = http_build_query($postvars);
// Get current status
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $server . ':8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
if ($answer != 0) {
echo "Command failed";
} else {
echo "Command succeed";
}
?>
Re: Admin API Problems
hello,
I tried using the API and I've been able to successfully get two commands to work.
Please what are the other possible commands and how are their postvars know ?
I'll like to know if I can do email creation, creation of ftp account, and setting of MX records from the API.
Thanks in advance.
I tried using the API and I've been able to successfully get two commands to work.
Please what are the other possible commands and how are their postvars know ?
I'll like to know if I can do email creation, creation of ftp account, and setting of MX records from the API.
Thanks in advance.
Re: Admin API Problems
They're all shown here, you can open each one to check the paramssirpros wrote:hello,
I tried using the API and I've been able to successfully get two commands to work.
Please what are the other possible commands and how are their postvars know ?
I'll like to know if I can do email creation, creation of ftp account, and setting of MX records from the API.
Thanks in advance.
https://github.com/serghey-rodin/vesta/tree/master/bin
Re: Admin API Problems
Thanks a lot.
Sergey is the man....always been.
Sergey is the man....always been.