4.1.3 Step 2: Generate PAR URL

Generate the PAR URL your Profitability and Balance Sheet Management Cloud Service by:

  1. Submitting a RESTful API Post Request to your Profitability and Balance Sheet Management 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 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