diff --git a/getbalance.sh b/getbalance.sh index 3ab8fcf..15559ca 100755 --- a/getbalance.sh +++ b/getbalance.sh @@ -1 +1,5 @@ -curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/balance" -s | jq +BAL=$(curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/balance" -s) +AMOUNT=$(echo $BAL | jq '.amount') +CUR=$(echo $BAL | jq '.currency' | sed -e 's:"::g' ) +AMOUNT=$(echo "scale=2; $AMOUNT/10000" | bc -l) +echo $CUR $AMOUNT