Skip to content

Instantly share code, notes, and snippets.

@edrex
Last active August 29, 2015 14:18
Show Gist options
  • Save edrex/8aaea3f453fe46237c1f to your computer and use it in GitHub Desktop.
Save edrex/8aaea3f453fe46237c1f to your computer and use it in GitHub Desktop.
tank helper command for working with the TiddlyWeb API at https://tank.peermore.com/

Examples

export TANK_KEY="my tank key"

tank GET /bags

cat | tank PUT /bags/myNewBag Content-Type:'application/vnd.tiddlyweb+json
{"policy":{}}
^D

tank PUT /bags/myNewBag/tiddlers/app Content-Type:'text/html' < app.html

You might need to remove Accept:text/plain from the last line for some uses, not sure.

More at http://httpie.org

#!/bin/sh
usage ()
{
echo 'Usage : tank <VERB> <path> [additional http args ... ]'
echo 'See "http" for additional usage information'
echo ""
exit
}
if [ "x$(which http)" = "x" ]
then
echo "http command not found. Please see installation instructions at http://httpie.org"
exit
fi
if [ "x$TANK_KEY" = "x" ]
then
echo "TANK_KEY environment variable must be set. See https://tank.peermore.com/auth to obtain an API key."
exit
fi
if [ "$#" -lt 2 ] || [ "x$TANK_KEY" = "x" ]
then
usage
fi
verb=$1
path=$2
shift 2
http $verb https://tank.peermore.com$path Authorization:"bearer $TANK_KEY" Accept:text/plain $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment