Compare commits
2 commits
ffef8f66d2
...
a50c9c924c
Author | SHA1 | Date | |
---|---|---|---|
a50c9c924c | |||
a1a719088d |
1 changed files with 12 additions and 4 deletions
16
requests.sh
16
requests.sh
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
ACTION=$1
|
ACTION=$1
|
||||||
TOKEN=$2
|
VALUE=$2
|
||||||
ACTIONS=(login register rcvpw username)
|
ACTIONS=(login register rcvpw username data csv)
|
||||||
|
|
||||||
print_help(){
|
print_help(){
|
||||||
echo "Usage: $0 ACTION [TOKEN]"
|
echo "Usage: $0 ACTION [TOKEN|INPUT_TYPE]"
|
||||||
echo
|
echo
|
||||||
echo "available actions:"
|
echo "available actions:"
|
||||||
for el in "${ACTIONS[@]}"; do
|
for el in "${ACTIONS[@]}"; do
|
||||||
|
@ -34,7 +34,15 @@ case $ACTION in
|
||||||
;;
|
;;
|
||||||
"${ACTIONS[3]}") # get current username
|
"${ACTIONS[3]}") # get current username
|
||||||
echo "get username action"
|
echo "get username action"
|
||||||
curl localhost:5050/api/username -X GET -H "Authorization: Bearer $TOKEN"
|
curl localhost:5050/api/username -X GET -H "Authorization: Bearer $VALUE"
|
||||||
|
;;
|
||||||
|
"${ACTIONS[4]}") # get all data from behametricsserver
|
||||||
|
echo "get data action"
|
||||||
|
curl localhost:5000/data
|
||||||
|
;;
|
||||||
|
"${ACTIONS[5]}") # get all data from behametricsserver
|
||||||
|
echo "get data action"
|
||||||
|
curl localhost:5000/data/csv/"${VALUE}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: Action not available"
|
echo "Error: Action not available"
|
||||||
|
|
Loading…
Reference in a new issue