We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
Creating additional ftp user via api
Creating additional ftp user via api
Hello,
How we create additionla ftp users via api? I tried this php code but not working.
How we create additionla ftp users via api? I tried this php code but not working.
Code: Select all
<?php
// Server credentials
$vst_hostname = 'server.website.ru';
$vst_username = 'admin';
$vst_password = 'pass';
$vst_returncode = 'yes';
$vst_command = 'v-add-web-domain-ftp';
// Prepare POST query
$postvars = array(
'user' => $vst_username,
'password' => $vst_password,
'returncode' => $vst_returncode,
'cmd' => $vst_command,
'arg1' => 'website.ru',
'arg2' => 'newftpuser',
'arg3' => 'newpass',
'arg4' => '/newfolder'
);
$postdata = http_build_query($postvars);
// Send POST query via cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $vst_hostname . ':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);
// Check result
if($answer == 0) {
echo "Ftp has been successfuly created\n";
} else {
echo "Query returned error code: " .$answer. "\n";
}
?>
Re: Creating additional ftp user via api
API documentation and examples:
http://vestacp.com/docs/API.pdf
CLI commands list and descriptions:
http://vestacp.com/docs/CLI.txt
-> viewtopic.php?f=18&t=12610
http://vestacp.com/docs/API.pdf
CLI commands list and descriptions:
http://vestacp.com/docs/CLI.txt
-> viewtopic.php?f=18&t=12610