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 / 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]