Created
December 2, 2015 18:48
-
-
Save MrNice/a16346049cd288657ab6 to your computer and use it in GitHub Desktop.
API Peek
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
# get these into your shell somehow | |
# apI PeeK: Look at an API response and temp save it | |
function ipk { | |
echo "Don't use the output flag from curl as it redirects" | |
curl "$@" | python -m json.tool | tee "apipeek.json" | less | |
} | |
# I PicK UP: rename the peeked api response (just partially applied mv) | |
function ipkup { | |
mv apipeek.json $1 | |
} | |
# I PeeK ON: ipk + ipkup. Don't give cURL the output -O flag | |
function ipkon { | |
echo "First argument is filename, rest goes to curl" | |
ipk "${@:2}" | |
ipkup $1 | |
} | |
# usage | |
ipkon pokemon.json http://pokeapi.co/api/v1/pokedex/1/ | |
ipkon blastoise.json http://pokeapi.co/api/v1/pokemon/9/ | |
# Note: ipk ipkup ipkon can be typed right handed on American QWERTY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment