Move tempfile to /tmp/ and make it consistent
This commit is contained in:
parent
4942f24344
commit
c6eca387c1
6
fax.sh
6
fax.sh
|
@ -23,11 +23,11 @@ then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
#save payload to tempfile to prevent curl from throwing 'argument list too long' error.
|
#save payload to tempfile to prevent curl from throwing 'argument list too long' error.
|
||||||
echo '{"faxlineId":"f0", "recipient":"'${REC}'", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}' > $BASEPATH/.data.txt
|
echo '{"faxlineId":"f0", "recipient":"'${REC}'", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}' > /tmp/sipgatedata.txt
|
||||||
#Send fax
|
#Send fax
|
||||||
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' )
|
FAXID=$(curl --request POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data @/tmp/sipgatedata.txt "https://api.sipgate.com/v2/sessions/fax" -s | jq '.sessionId' | sed -e 's:"::g' )
|
||||||
#remove tempfile
|
#remove tempfile
|
||||||
rm $BASEPATH/.data.txt
|
rm /tmp/sipgatedata.txt
|
||||||
if [ -z $FAXID ]
|
if [ -z $FAXID ]
|
||||||
then
|
then
|
||||||
echo "Something went wrong, I didn't receive some fax id back."
|
echo "Something went wrong, I didn't receive some fax id back."
|
||||||
|
|
Loading…
Reference in a new issue