Created
January 10, 2022 19:00
-
-
Save gschanuel/686f69e087eeb03b6e018e1c44f40cf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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