Created
March 16, 2017 13:36
-
-
Save mariow/f6afbd8c6eb689ce839a997f44b6b3eb to your computer and use it in GitHub Desktop.
In case you ever have the need to delete all zones from your account at NS1.net via a script: this will do the job.
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
#!/bin/bash | |
# | |
# WARNING: This script will delete all zones from an account at nsone.net via the API, USE WITH CARE | |
# | |
NSONEKEY="YOURKEYHERE" | |
curl -X GET -H "X-NSONE-Key: $NSONEKEY" https://api.nsone.net/v1/zones > zones.json | |
perl -ane 'while (/zone":"([^"]+?)"/g) { print $1."\n" }' < zones.json > zones-left.txt | |
wc -l zones-left.txt | |
for i in `cat zones-left.txt `;do curl -X DELETE -H "X-NSONE-Key: $NSONEKEY" https://api.nsone.net/v1/zones/$i; sleep 1; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment