From 38a10869c16a6e1086ea9c9bfacef904b8b07f69 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Wed, 10 Mar 2021 17:09:13 +0100 Subject: [PATCH] Solve too long argument list for curl Thanks to https://stackoverflow.com/a/54091092 --- fax.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fax.sh b/fax.sh index 6962bad..903c299 100755 --- a/fax.sh +++ b/fax.sh @@ -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