cURL Sample – GeneratePrgDocReport.sh for Profitability and Cost Management

Prerequisites: jq http://stedolan.github.io/jq/download/linux64/jq

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

funcProgramDocReportJob() {
	url=$SERVER_URL/epm/rest/$API_VERSION/applications/$APP_NAME/povs/$POV_GROUP_MEMBER1/jobs/programDocReportJob
        stringDelimter="_";
        param="{\"fileName\":\"2016JanActual.pdf\",\"fileType\":\"PDF\",\"useAlias\":\"false\",\"stringDelimter\":\"$stringDelimter\"}"
        
        echo $param
	funcExecuteRequest "POST" $url $param "application/json"

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