Created
November 20, 2017 17:19
-
-
Save anabelle/732e98f959376c85594957971c78cb60 to your computer and use it in GitHub Desktop.
A node.js script to change the paused status of all the sites under a cloudflare account at once.
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
// run 'npm install cloudflare' before running this script | |
var cf = require('cloudflare')({ | |
email: '[email protected]', // Your cloudflare account email | |
key: 'yourapikey' // Your cloudflare api key, found in CLoudflare > My profile | |
}); | |
cf.zones.browse({per_page: 60}).then( function( resp ){ | |
for (var i = resp.result.length - 1; i >= 0; i--) { | |
console.log( "domain: ", resp.result[i].name ); | |
cf.zones.edit( resp.result[i].id, { paused: true } ).then( function( resp ){ // change to paused: false when you want to unpause. | |
console.log("Paused: ", resp ); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment