Hello,
im trying to create an A record with the cloudflare API, but im getting every time this error:
ClientException {#791 ▼
-request: Request {#779 ▶}
-response: Response {#795 ▶}
-handlerContext: []
#message: """
Client error: `POST https://api.cloudflare.com/client/v4/zones/0c63dba01fa136cffd2b8ee3e28959c6/dns_records` resulted in a `400 Bad Request` response:\n
{\n
"result": null,\n
"success": false,\n
"errors": [\n
{\n
"code": 1004,\n
"message": "DNS Validation Error", (truncated...)\n
"""
#code: 400
#file: "/var/www/pterodactyl/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php"
#line: 113
trace: {▶}
}
This is the PHP laravel code I am using:
$data1 = array(
'type' => 'A',
'data' => array(
"name" => $subdomain,
"content" => 'myip',
"ttl" => 120,
"proxied" => false,
)
);
try {
if ($dns->addRecord($zoneID, $data1) !== true) {
$this->alert->danger('Failed to create subdomain.')->flash();
return redirect()->route('server.subdomain', $server->uuidShort);
}
} catch (\Exception $e) {
dd($e);
$this->alert->danger('Failed to create subdomain.')->flash();
return redirect()->route('server.subdomain', $server->uuidShort);
}
Can someone tell me what i am doing wrong? since i can’t find a clear problem in the error