Cloudflare Apiv4 Issue [{"code":9020,"message":"Invalid DNS record type"}]}]

I am having issue while using Cloudflare APIv4. I am trying to update a dns record and receiving following error:

{"success":false,"errors":[{"code":1004,"message":"DNS Validation Error","error_chain":[{"code":9020,"message":"Invalid DNS record type"}]}],"messages":,"result":null}

Following is the PHP function:

   function updateCloudflareDNS($zone_id,$dns_id){
   $updatedata = '[{"name":""},{"type":"A"},{"ttl":"1"},{"content":""}, 
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, 
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json; charset=utf-8',
    'X-Auth-Email: **********',
    'X-Auth-Key: ***********'
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $updatedata);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);    
    $response = curl_exec($ch);
   return $response;

Also, I am putting record type “A” correctly as mentioned on the Cloudflare API documentation

Could someone help me out with this issue?


Check your JSON string. It does not match the example in your link.

Stupid mistake… Thanks