#!/bin/bash host="${PM_API_HOST:-localhost:8081}" if [ $# -eq 1 ]; then url="$1" method="GET" data="" elif [ $# -eq 2 ]; then method="$1" url="$2" data="" else method="$1" url="$2" data="$3" fi curl -s -X "$method" \ -H "Content-Type: application/json" \ -H "Authorization: $(cat credential)"\ "http://${host}/api/$url" \ -d "$data"