From a4e6a4cb814851f16a011799e3796b0531776c76 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Thu, 30 Nov 2017 12:26:21 -0600 Subject: [PATCH] Add simple CLI client based on cURL. --- src/util/bash/client.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 src/util/bash/client.sh diff --git a/src/util/bash/client.sh b/src/util/bash/client.sh new file mode 100755 index 0000000..a51cf58 --- /dev/null +++ b/src/util/bash/client.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +host="${STRAWBOSS_HOST:-localhost:8180}" +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 -X "$method" -H "Authorization: Bearer $(cat token.txt)" "http://${host}/api/$url" -d "$data" +echo "" +#echo "curl -X \"$method\" -H \"Authorization: Bearer $(cat token.txt)\" \"localhost:8180/api/$url\" | jq . "