Skip to content

Instantly share code, notes, and snippets.

@kari
Created September 17, 2021 04:41
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 kari/0d4c61cfec9930d0195d2e5d71d7490d to your computer and use it in GitHub Desktop.
Save kari/0d4c61cfec9930d0195d2e5d71d7490d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
TOKEN="APITOKEN"
ENDPOINT="https://api.gandi.net/v5"
DOMAIN="DOMAIN"
NAME="NAME"
IPV4="$(curl -s https://api.ipify.org)"
IPV6="$(curl -s https://api6.ipify.org)"
TTL=10800
curl -X PUT -H "Content-Type: application/json" \
-H "Authorization: Apikey $TOKEN" \
-d "{\"items\": [{\"rrset_type\": \"AAAA\",
\"rrset_ttl\": $TTL,
\"rrset_values\": [\"$IPV6\"]},
{\"rrset_type\": \"A\",
\"rrset_ttl\": $TTL,
\"rrset_values\": [\"$IPV4\"]}]}" \
$ENDPOINT/livedns/domains/$DOMAIN/records/$NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment