This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: [1]
1
CWP API / Re: Add email account error
« on: March 26, 2021, 10:42:59 AM »
I don't know if this is the right solution, but for now it works. I changed phone and email_other in the database to a default value of 0. Maybe if CWP updates the database will change and delete this default values...
https://ibb.co/myDxrtY
https://ibb.co/myDxrtY
2
CWP API / Add email account error
« on: March 09, 2021, 07:22:29 AM »
Hello,
I'm trying to add an email account with an api call. All fields are filled in correctly but i keep getting the same error.
string(101) "{"status":"Error","result":"Error writing to BD","code":"Field 'phone' doesn't have a default value"}"
My api call:
$key = $session->get('cwp_key');
$ip = $session->get('cwp_ip');
$data = array('key' => $key, 'action'=>'add', 'user'=> $_GET['id'], 'email'=>'example', 'domain'=>'example.com', 'pass'=>'eJ0qPsGZdadsfe', 'quotamail'=>'50');
$url = "https://" . $ip . ":2304/v1/email";
$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_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
I'm trying to add an email account with an api call. All fields are filled in correctly but i keep getting the same error.
string(101) "{"status":"Error","result":"Error writing to BD","code":"Field 'phone' doesn't have a default value"}"
My api call:
$key = $session->get('cwp_key');
$ip = $session->get('cwp_ip');
$data = array('key' => $key, 'action'=>'add', 'user'=> $_GET['id'], 'email'=>'example', 'domain'=>'example.com', 'pass'=>'eJ0qPsGZdadsfe', 'quotamail'=>'50');
$url = "https://" . $ip . ":2304/v1/email";
$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_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
Pages: [1]