Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
token="YOUR_TOKEN"
domains="yourdomain1.com yourdomain2.com"
zones=$(curl -s \
-H "Authorization: Bearer $token" \
-H "Accept: application/json" \
https://dynv6.com/api/v2/zones)
for domain in $domains; do
zoneid=$(jq ".[] | select(.name==\"$domain\") | .id" <<< $zones)
records=$(curl -s \
-H "Authorization: Bearer $token" \
-H "Accept: application/json" \
https://dynv6.com/api/v2/zones/$zoneid/records)
if [ -z "$(jq '.[] | select(.name == "*")' <<< $records)" ]; then
curl -s \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{"name":"*", "data":"", "type":"CNAME"}' \
https://dynv6.com/api/v2/zones/$zoneid/records
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment