Skip to content

Instantly share code, notes, and snippets.

@gschanuel
Created January 10, 2022 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gschanuel/686f69e087eeb03b6e018e1c44f40cf6 to your computer and use it in GitHub Desktop.
Save gschanuel/686f69e087eeb03b6e018e1c44f40cf6 to your computer and use it in GitHub Desktop.
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