I wish to access CloudFlare from my C# code and add DNS records to it. I am using the CloudFlare API and have found the following code to achieve my goal:
CFProxy.Dns.Add("example", "127.0.0.1", "example.com", DnsRecordKind.CNAME, 1);
However, as I run the program it gives the error :
Zone does not exist.
Anybody familiar on how to resolve this issue?
I was able to work through the existing code that I have.
After a series of researching and trial-and-error, I found out that I was passing incorrect arguments to the Add parameters of CFProxy.DNS.
As in the example, "example.com" is a domain/URL that is not a recognized zone in my CloudFlare account. That's why it kept on returning the error "Zone does not exist."
You must first identify as to which zone/domain your CloudFlare account has from where you can add records. Below is the correct one:
CFProxy.Dns.Add("example.name.com", "site.namesite.com", "name.com", DnsRecordKind.CNAME, 1);
WHERE: example.name.com = is the name of the site URL you wish to add ; site.namesite.com = is the site URL/IP you would like to put the alias on ; name.com = is the zone/domain where you add records in your CloudFlare account.
And ofcourse the other 2 parameters are for what record type you wish to add (as in this case, CNAME) and 1 for Automatic TTL.