Hello,
I have a little problem when I use the "POST /domains" endpoint( Other endpoints work fine).
Here is my request in PHP :
And my problem is that the request is executed twice, once, or it executes directly and creates the domain and connects it to the customer, and the second request tells me the message: string(98) "{ "code": 1007, "message": "Incorrect name example.com. This domain name already exists." }"
But I want to get the results of the first query to save them in a database, and I can't because it only shows me the results of the second query.
If someone here has a solution
Regards.
I have a little problem when I use the "POST /domains" endpoint( Other endpoints work fine).
Here is my request in PHP :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://myplesk.domain:8443/api/v2/domains');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"name\": \"example.com\", \"description\": \"example\", \"hosting_type\": \"virtual\", \"hosting_settings\": { \"ftp_login\": \"testt\", \"ftp_password\": \"somepassword\" },\"owner_client\": { \"id\": 38, \"login\": \"john-unit-test\", \"guid\": \"fb88e0c7-804a-4e4f-8bef-*******\", \"external_id\": \"fb88e0c7-804a-4e4f-8bef-********\" },\"ipv4\": [ \"135.181.***.***\" ],\"plan\": { \"name\": \"Unlimited\" }}");
curl_setopt($ch, CURLOPT_USERPWD, 'root' . ':' . '*********');
$headers = array();
$headers[] = 'Accept: application/json';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$final = json_decode($ch,true);
curl_close($ch);
And my problem is that the request is executed twice, once, or it executes directly and creates the domain and connects it to the customer, and the second request tells me the message: string(98) "{ "code": 1007, "message": "Incorrect name example.com. This domain name already exists." }"
But I want to get the results of the first query to save them in a database, and I can't because it only shows me the results of the second query.
If someone here has a solution
Regards.