Dynamic DNS update

Is it also possible to use the cloudflare API to update dynamic DNS records in a single line https command?

I coming from Google where I have used this:
https://username:[email protected]/nic/update?hostname=subdomain.yourdomain.com&myip=1.2.3.4

Possible in a single http request? Sure. Cloudflare doesn’t support basic auth though. As long as you know the dns record id and the id of the zone, updating a dns record is just like:

curl --request PATCH \
  --url https://api.cloudflare.com/client/v4/zones/<zone_id>/dns_records/<dns_record_id> \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <apitoken> ' \
  --data '{
  "content": "198.51.100.4",
  "name": "dyn.example.com",
  "proxied": false,
  "type": "A",
  "ttl": 3600
}
1 Like

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