cURL Sample – RunCalculation.sh for Profitability and Cost Management

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

funcRunCalculation() {
	subsetStart=""
	subsetEnd=""
	ruleName=""
	ruleSetName=""
	comment="Run Calculation Curl"
	exeType="ALL_RULES"
	stringDelimiter="_"
	param="{\"isClearCalculated\":\"true\",\"isExecuteCalculations\":\"true\",\"isRunNow\":\"true\",\"comment\":\"$comment\",\"subsetStart\":\"$subsetStart\",\"subsetEnd\":\"$subsetEnd\",\"ruleName\":\"$ruleName\",\"ruleSetName\":\"$ruleSetName\",\"exeType\":\"$exeType\",\"stringDelimiter\":\"$stringDelimiter\"}"
	url=$SERVER_URL/epm/rest/$API_VERSION/applications/$APP_NAME/povs/$POV_GROUP_MEMBER/jobs/runLedgerCalculationJob
	funcExecuteRequest "POST" $url "$param" "application/json"

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