Control Web Panel
WebPanel => CentOS-WebPanel Bugs => Topic started by: trcosta on June 29, 2018, 05:35:34 PM
-
When I try to add acount via api I get mysql errors.
(https://plus.google.com/u/0/photos/albums/p7pt2h5f8gvjicrjku5p302ruvlfcgdkc?pid=6572552793766851938&oid=102187499680484591753)
-
Can you show the errors thrown at you?
-
Sorry, the image did not appeear.
Here is the image with the error:
(https://imageshack.com/a/img921/3523/krcIGJ.png)
-
You could put here an example of the code that you are using for the invocation of the Api
-
I just changed the key below...
The user is in /etc/passwd after run the code, even with error messages shown in figure. I can connect to ftp using the user, but the user is not listed in cwp accounts in "list accounts".
<?php
$data = array(
"key" => 'mykey',
"action"=>'add',
"domain"=>'valiati5.com.br',
"user"=>'valiati5',
"pass"=>'32165487Ds821',
"email"=>'daniels@valiati5.com.br',
"package"=>'default',
"inode"=>0,
"limit_nproc"=>40,
"limit_nofile"=>100,
"server_ips"=>'177.53.142.39'
);
$url = "https://177.53.142.39:2304/v1/account";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
echo '<pre>';
print_r($response);
echo '</pre>';
-
Change "package" => 'default', for "package" => 1,
-
I will try tomorrow and post results here :)
-
It is ok, solved.
Thanks.