3.3.3.2 Step 2: Generate PAR URL
Generate the PAR URL for your Profitability and Balance Sheet Management Cloud Service by:
- Submitting a RESTful API Post Request to your Cloud Service as defined in the Calling the API to Generate the URL section.
Note a sample code snippet has been provided below using cURL to generate the PAR URL and assign it to a variable for use within a script:
PAR URL Generation Code Snippet
curl --location --insecure --request POST "$FILEUPLOADURL" --header "Authorization: Bearer $access_token" --header 'Content-Type: application/json' --data-raw "{
\"fileName\": \"$1\",
\"fileSize\": \"$2\",
\"mimeType\": \"$3\"
}" >> "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse.out 2>&1
PAR URL Variable Assignment Code Snippet
grep -oE '(https)[^ ]*' "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse.out > "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse1.csv
while IFS="," read -r H1 H2
do
URLtrim="$H1"
FinalPAR=${URLtrim::-1}
echo -e "\n PAR_URL is $FinalPAR"
done < "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse1.csv
PAR URL Variable Assignment Code Snippet – Used in File Scanning Step
grep -oE '(fileId)[^ ]*' "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse.out > "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse2.csv
while IFS="," read -r F1 F2
do
FILEIDtrim="$F1"
FINALFILEID=`echo "$FILEIDtrim"| sed -r 's/^.{8}//'`
echo -e "\n FILE ID is $FINALFILEID"
done < "$HOME"/FILEUPLOAD_UTIL/"$1"_PARURLresponse2.csv