cURL Sample – ImportTemplate.sh for Oracle Profitability and Cost Management Cloud

Common functions: See Oracle Profitability and Cost Management Cloud Common Helper Functions for cURL.

funcImportTemplate() {
	description="Import Template through Curl Sample"
	instance="PROFITABILITY_WEB_APP"
	essAppServer="EssbaseCluster-1"
	sharedServicesProject="EssbaseCluster-1"
	applicationType="Management Ledger"
	fileName="PCM_BksML12_20160413_042937.zip"
	isApplicationOverwrite="true"
	param="{\"description\":\"$description\",\"instanceName\":\"$instance\",\"essApplicationServer\":\"$essAppServer\",\"sharedServicesProject\":\"$sharedServicesProject\",\"applicationType\":\"$applicationType\",\"fileName\":\"$fileName\",\"isApplicationOverwrite\":\"$isApplicationOverwrite\"}"
	url=$SERVER_URL/epm/rest/$API_VERSION/applications/$APP_NAME/jobs/templateImportJob
	funcExecuteRequest "POST" $url "$param" "application/json"

	output=`cat response.txt`
	status=`echo $output | jq '.status'`
    if [ $status == -1 ]; then
        echo "Started importing successfully"
		funcGetStatus "GET"
    else
        error=`echo $output | jq '.details'`
        echo "Error occurred. " $error
    fi
	funcRemoveTempFiles "respHeader.txt" "response.txt"
}