Created
August 28, 2015 21:14
-
-
Save v1ct0rv/9a2a33f868981db6f797 to your computer and use it in GitHub Desktop.
Update clodflare record from command line
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
# List Cloudflare zones and copy the zone do you want to update | |
curl -X GET "https://api.cloudflare.com/client/v4/zones?name=example.com&status=active&page=1&per_page=20&order=status&direction=desc&match=all" \ | |
-H "X-Auth-Email: cloudflere_email" \ | |
-H "X-Auth-Key: cloudflare_apikey" \ | |
-H "Content-Type: application/json" | |
# List DNS Records paste the zone from previous command | |
curl -X GET "https://api.cloudflare.com/client/v4/zones/paste_here_zone_id/dns_records?type=A&page=1&per_page=20&order=type&direction=desc&match=all" \ | |
-H "X-Auth-Email: cloudflere_email" \ | |
-H "X-Auth-Key: cloudflare_apikey" \ | |
-H "Content-Type: application/json" | |
# Update Dns Record this command can be put on a cronjob. | |
wget -qO- http://checkip.amazonaws.com | xargs -I {} curl -X PUT "https://api.cloudflare.com/client/v4/zones/paste_here_zone_id/dns_records/paste_here_record_id" \ | |
-H "X-Auth-Email: cloudflere_email" \ | |
-H "X-Auth-Key: cloudflare_apikey" \ | |
-H "Content-Type: application/json" \ | |
--data '{"id":"372e67954025e0ba6aaa6d586b9e0b59","type":"A","name":"example.com","content":"{}","proxiable":true,"proxied":false,"ttl":120,"locked":false,"zone_id":"paste_here_zone_id","zone_name":"example.com","created_on":"2014-01-01T05:20:00.12345Z","modified_on":"2014-01-01T05:20:00.12345Z","data":{}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment