Is it possible to upload a file [probably CVS format] of CNAME Records to my DNS settings?
It needs to be in BIND format. I don’t think it will replace the entire zone file. Hopefully someone can confirm this.
As sdayman notes, it needs to be in BIND zone format but this is actually very simple to accomplish, you really just need a SOA record (which is ignored anyway) then one or more lines of zonefile.
example.com. 3600 IN SOA ns3.Cloudflare.com. dns.Cloudflare.com. 2029208958 10000 2400 604800 300
bob CNAME target.example.com.
jim CNAME target.example.com.
Uploading a new zonefile will (sadly) only add records, but in this situation it will make things easier.
You could also consider using the API, Cloudflare’s documentation give you examples that are almost copy-and-paste simple if you have curl installed. You can Create a DNS record fairly easily, you’ll need your account’s email address and API key, but otherwise you just need to use this command to list zones:
curl -X GET "https://api.cloudflare.com/client/v4/zones?name=example.com&status=active&page=1&per_page=20&order=status&direction=desc&match=all" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json"
Note the ID of the zone you want to modify, then see the example to add a record:
curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json" \
--data '{"type":"A","name":"example.com","content":"127.0.0.1","ttl":120,"priority":10,"proxied":false}'
You’ll need to fill in your authentication again, of course, and then replace the zone ID in the base URL, but beyond that you can see the record details that you need to update, replace the A with CNAME and complete the other details and call this same API call repeatedly as many times as needed.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.