Created
August 15, 2018 03:27
-
-
Save colinwilson/c83077c72203efc34ea252c8040fa81c to your computer and use it in GitHub Desktop.
CloudFlare: Clear cache and enable development mode via API
This file contains 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
[email protected] | |
tkn=<API KEY> | |
domain=wyveo.com | |
zone=$(curl -s -X GET "https://api.CloudFlare.com/client/v4/zones?name=${domain}&status=active&page=1&per_page=20&order=status&direction=desc&match=all" \ | |
-H "X-Auth-Email: ${email}" \ | |
-H "X-Auth-Key: ${tkn}" \ | |
-H "Content-Type: application/json") | |
zone=${zone:18:32} | |
curl -X DELETE "https://api.CloudFlare.com/client/v4/zones/${zone}/purge_cache" \ | |
-H "X-Auth-Email: ${email}" \ | |
-H "X-Auth-Key: ${tkn}" \ | |
-H "Content-Type: application/json" \ | |
--data '{"purge_everything":true}' | |
curl -X PATCH "https://api.cloudflare.com/client/v4/zones/${zone}/settings/development_mode" \ | |
-H "X-Auth-Email: ${email}" \ | |
-H "X-Auth-Key: ${tkn}" \ | |
-H "Content-Type: application/json" \ | |
--data '{"value":"on"}' | |
unset zone email tkn domain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment