#! /bin/bash . authorization.sh #Prepare fax credentials: FILE=$1 echo $FILE REC=$(echo $2 | sed -e 's:[^+0-9]::g' -e 's:^0\([1-9]\):+49\1:') #Needs to be base64 encoded: CONTENT=$(base64 $FILE -w 0) if [ -z "$CONTENT" ]; then echo "Encoding failed" fi DATA='{"faxlineId":"f0", "recipient":"+495512829364", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}' #Send fax curl -i --request POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data "$DATA" "https://api.sipgate.com/v2/sessions/fax" -s echo #Check if fax request was accepted by sipgate curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/history" -s | jq #And show the account balance . getbalance.sh