I'm posting it here because when I needed everything I found on google was links to another post that didn't even have anything useful at all...
Tested and working with the RouterOS v6.44 on a hAP Lite. (tested on this post's date!)
If you need to get your zone ID you can just curl a zone list and manually get the ID from the returned json as I did!
Not going into the merit of puting it as an script option, if you need help doing this just contact me and I will help, but it's very simple to do and I don't think anyone will really need a hand...
Code: Select all
:global cfu do={\
:local cfi "THE_ZONE_ID";\
:local cfr "THE_RECORD_ID";\
:local cfe "ACCOUNT_EMAIL_ADDRESS";\
:local cfk "API_GLOBAL_KEY";\
:local cfd "THE_RECORD_DOMAIN";\
:local cfa [/ip cloud get public-address];\
:local cfp true;\
/tool fetch mode=https\
http-method=put\
url="https://api.cloudflare.com/client/v4/zones/$cfi/dns_records/$cfr"\
http-header-field="content-type:application/json,X-Auth-Email:$cfe,X-Auth-Key:$cfk"\
http-data="{\"type\":\"A\",\"name\":\"$cfd\",\"content\":\"$cfa\",\"proxied\":$cfp}"\
output=none\
}
If you need help setting it up, just follow this tutorial.