Skip to content

Instantly share code, notes, and snippets.

@romain-dartigues
Forked from elbuo8/doapi.sh
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romain-dartigues/4d7e4edcb33ebd5ac988 to your computer and use it in GitHub Desktop.
Save romain-dartigues/4d7e4edcb33ebd5ac988 to your computer and use it in GitHub Desktop.
{
echo '{'
for endpoint in sizes regions images ssh_keys; do
echo -n '"'$endpoint'": '
curl -s "https://api.digitalocean.com/${endpoint}/?client_id=${DO_CLIENT_ID}&api_key=${DO_API_KEY}"
echo ','
done | sed '$s/,$//'
echo '}'
} | python -mjson.tool
@romain-dartigues
Copy link
Author

Like the original but does not require bash array and output a parsable JSON.

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