diff --git a/api/src/util/bash/client.sh b/api/src/util/bash/client.sh new file mode 100755 index 0000000..b3dab9b --- /dev/null +++ b/api/src/util/bash/client.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +host="${PM_API_HOST:-localhost:8080}" +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" | jq .