Skip to content

Instantly share code, notes, and snippets.

@chdsbd
Last active October 8, 2016 16:55
Show Gist options
  • Save chdsbd/59b45425b7f105576e45003614d4ca94 to your computer and use it in GitHub Desktop.
Save chdsbd/59b45425b7f105576e45003614d4ca94 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Clouflare's old v1 api - https://www.cloudflare.com/docs/client-api.html
IP=`dig +short myip.opendns.com @resolver1.opendns.com`
curl -X PUT https://api.cloudflare.com/client/v4/zones/<ZONE-ID>/dns_records/<REC-ID> \
-H 'X-Auth-Email: <ACCOUNT-EMAIL>' \
-H 'X-Auth-Key: <API-TOKEN>' \
-H 'Content-Type: application/json' \
--data '{
"type": "A",
"name": "<SUBDOMAIN-NAME>",
"content": "'"$IP"'",
"proxied": false,
"ttl": 120
}'
@chdsbd
Copy link
Author

chdsbd commented Oct 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment