#!/bin/bash HOST='localhost' PORT='1288' VERSION='v1' BASE=http://$HOST:$PORT/$VERSION if [ $# -lt 1 ] then echo "list - create-node - delete-node - show" fi case "$1" in list) curl -sS $BASE/nodes/ | python -m json.tool echo ""; ;; create-node) curl -sS -H "Content-Type: application/json" -X POST $BASE/nodes/ -d '{"code":"'"$2"'","location":{}}' | python -m json.tool echo ""; ;; delete-node) curl -sS -X DELETE $BASE/nodes/$2 | python -m json.tool echo ""; ;; show) curl -sS $BASE/nodes/$2 | python -m json.tool echo ""; ;; *) echo "list - create-node - delete-node - show" esac