Adding a site via API, no DNS records

I’m using this to create new sites (zones, I guess):

create=$(curl --request POST
–silent
–url https://api.cloudflare.com/client/v4/zones
–header ‘Content-Type: application/json’
–header “X-Auth-Email: $email”
–header “X-Auth-Key: $key”
–data ‘{
“account”: {
“id”:"’$account’"
},
“name”: “‘$domain’”,
“type”: “full”
}’ | jq ‘.success’)

This works, but it doesn’t copy over the DNS records like it does when I add a site in the dashboard.

Is that the way it’s supposed to be doing? If so then that’s fine (preferred, in fact), I just wasn’t sure if this was a fluke on my test site.

Scan would be an additional call:

https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-scan-dns-records

Personally, I’d prefer an import of the zone file, just to make sure it’s complete:

https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-import-dns-records

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.