Added cURL-based CLI client script.
This commit is contained in:
parent
e3450d5f8f
commit
706713f57a
22
api/src/util/bash/client.sh
Executable file
22
api/src/util/bash/client.sh
Executable file
@ -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 .
|
Loading…
x
Reference in New Issue
Block a user