Solve too long argument list for curl

Thanks to https://stackoverflow.com/a/54091092
callerid
Gandalf 2021-03-10 17:09:13 +01:00
parent 9c974392be
commit 38a10869c1
1 changed files with 4 additions and 2 deletions

6
fax.sh
View File

@ -22,12 +22,14 @@ then
echo "Encoding failed"
exit 2
fi
DATA='{"faxlineId":"f0", "recipient":"'${REC}'", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}'
echo '{"faxlineId":"f0", "recipient":"'${REC}'", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}' > $BASEPATH/.data.txt
#Send fax
FAXID=$(curl --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 | jq '.sessionId' | sed -e 's:"::g' )
FAXID=$(curl --request POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data @data.txt "https://api.sipgate.com/v2/sessions/fax" -s | jq '.sessionId' | sed -e 's:"::g' )
rm $BASEPATH/.data.txt
if [ -z $FAXID ]
then
echo "Something went wrong, I didn't receive some fax id back."
exit 2
else
echo "Sipgate took your fax as sessionID $FAXID"
echo "$FAXID" >> $BASEPATH/.fax_history