Skip to content

Instantly share code, notes, and snippets.

@hamiltont
Created January 21, 2014 22:22
Show Gist options
  • Save hamiltont/8549694 to your computer and use it in GitHub Desktop.
Save hamiltont/8549694 to your computer and use it in GitHub Desktop.
Update dnsimple.com using domain token and record ID (more secure than storing username and password in script)
#!/bin/bash
DOMAIN_ID="yourdomain.com"
RECORD_ID="9348341"
DOMAIN_TOKEN="8339c723c223445f6c876bca3fafffd3345"
IP="`curl http://ipv4.icanhazip.com/`"
JSON="{\"record\":{\"content\":\"$IP\"}}"
curl -H "X-DNSimple-Domain-Token: $DOMAIN_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X PUT -d $JSON \
https://api.dnsimple.com/v1/domains/$DOMAIN_ID/records/$RECORD_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment