diff --git a/rest_api/gandi/ddns_gandi.sh b/rest_api/gandi/ddns_gandi.sh new file mode 100644 index 0000000..c3b768a --- /dev/null +++ b/rest_api/gandi/ddns_gandi.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +ttl=300 +ip=${1} + +second_level_domain="$domain" +subdomain="{@}" + +depth=$(echo "$domain" | grep -o "[.]" | wc -l) + +if [ "$depth" -ge 2 ]; then + second_level_domain=$(echo "$domain" | cut -s -d '.' -f ${depth}-) + subdomain=$(echo "$domain" | cut -s -d '.' -f -$((depth - 1))) +fi + +echo "second_level_domain = ${second_level_domain}" +echo "subdomain = ${subdomain}" + +curl -fs -o /dev/null -X PUT -H "Content-Type: application/json" \ + -H "X-Api-Key: ${password}" \ + -d "{\"rrset_ttl\": ${ttl}, \"rrset_values\": [\"${ip}\"]}" \ + "https://dns.api.gandi.net/api/v5/domains/${second_level_domain}/records/${subdomain}/A" diff --git a/rest_api/hosting.de/ddns_hostingde.sh b/rest_api/hosting.de/ddns_hostingde.sh new file mode 100755 index 0000000..3be25ba --- /dev/null +++ b/rest_api/hosting.de/ddns_hostingde.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +ttl=300 +ip=${1} + +contents="[{\"content\":\"${ip}\"}]" + +curl -fs \ + -X POST -H "Content-Type: application/json" \ + -d "{\"authToken\":\"${password}\",\"hostname\":\"${domain}\",\"recordType\":\"A\",\"rrSetContents\":${contents},\"removeAllRecords\":\"true\"}" \ + "https://secure.hosting.de/api/dns/v1/json/resourceRecordSetUpdate"