thanks, I tried a few hours on my own, with success:
Update DynDNS:
Inject your IP:
[
{
"id": "b91e83e0f7871983",
"type": "function",
"z": "74b0442752a49876",
"name": "Cloudflare",
"func": "let IP = msg.payload;\nconst headers = {};\nheaders[\"Content-Type\"] = \"application/json\";\nheaders[\"X-Auth-Key\"] = \"Global API Key\";\nheaders[\"X-Auth-Email\"] = \"you@email.com\";\nmsg.method = \"PUT\";\nmsg.headers = headers;\nmsg.url = \"https://api.cloudflare.com/client/v4/zones/<your Zone ID>/dns_records/<your DNS Record ID>\";\nmsg.payload = {\"content\":IP,\"name\":\"mydomain.com\",\"proxied\":false,\"type\":\"A\",\"ttl\":60};\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 948,
"y": 802,
"wires": [
[
"26c84f3f549233bf"
]
]
},
{
"id": "26c84f3f549233bf",
"type": "http request",
"z": "74b0442752a49876",
"name": "Cloudflare",
"method": "use",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 1158,
"y": 802,
"wires": [
[]
]
}
]
proxied true or false
for IPv6: AAAA
(I´ve build these nodes 3x for A, AAAA at mydomain.com + AAAA at sub.mydomain.com)
to get your DNS Record IDs, you have to query first all your zones:
[
{
"id": "d5b74fd1cfbc7fc0",
"type": "http request",
"z": "74b0442752a49876",
"name": "Cloudflare",
"method": "use",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 430,
"y": 900,
"wires": [
[
"88dea0d47cdc0a1c"
]
]
},
{
"id": "443f3591bacd1345",
"type": "inject",
"z": "74b0442752a49876",
"name": "Request",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 420,
"y": 820,
"wires": [
[
"d807163b602bfeb0"
]
]
},
{
"id": "d807163b602bfeb0",
"type": "function",
"z": "74b0442752a49876",
"name": "Cloudflare request",
"func": "const headers = {};\nheaders[\"Content-Type\"] = \"application/json\";\nheaders[\"X-Auth-Key\"] = \"your Global Api Key\";\nheaders[\"X-Auth-Email\"] = \"you@email.com\";\nmsg.method = \"GET\";\nmsg.headers = headers;\nmsg.url = \"https://api.cloudflare.com/client/v4/zones/<your Zone ID>/dns_records/\";\nmsg.payload = {};\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 450,
"y": 860,
"wires": [
[
"d5b74fd1cfbc7fc0"
]
]
},
{
"id": "88dea0d47cdc0a1c",
"type": "debug",
"z": "74b0442752a49876",
"name": "Cloudflare",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 430,
"y": 940,
"wires": []
}
]
you´ll get an array with all your zones (and IDs):
payload.result[0].id
payload.result[1].id
...