Author Topic: API Problem when creating account  (Read 7522 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
API Problem when creating account
« on: June 29, 2018, 05:35:34 PM »
When I try to add acount via api I get mysql errors.


Offline
*****
Re: API Problem when creating account
« Reply #1 on: June 29, 2018, 07:37:36 PM »
Can you show the errors thrown at you?

Offline
*
Re: API Problem when creating account
« Reply #2 on: June 30, 2018, 11:11:02 AM »
Sorry, the image did not appeear.

Here is the image with the error:
« Last Edit: June 30, 2018, 11:12:38 AM by trcosta »

Offline
*****
Re: API Problem when creating account
« Reply #3 on: June 30, 2018, 11:22:51 AM »
You could put here an example of the code that you are using for the invocation of the Api

Offline
*
Re: API Problem when creating account
« Reply #4 on: June 30, 2018, 12:21:22 PM »
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>';

Offline
*****
Re: API Problem when creating account
« Reply #5 on: June 30, 2018, 12:36:59 PM »
Change "package" => 'default', for "package" => 1,

Offline
*
Re: API Problem when creating account
« Reply #6 on: July 02, 2018, 02:35:36 AM »
I will try tomorrow and post results here  :)

Offline
*
Re: API Problem when creating account
« Reply #7 on: July 02, 2018, 04:50:24 PM »
It is ok, solved.
Thanks.