Sipgate-CLI/getbalance.sh
2022-03-22 10:30:29 +01:00

6 lines
348 B
Bash
Executable file

BAL=$(curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --user $SIPUSER:$SIPPWD "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 "Your current balance is "$CUR $AMOUNT