Groovy Sample – EssbaseDataLoad.groovy for Oracle Profitability and Cost Management Cloud

Prerequisites: json.jar

Common functions: See Appendix C: Common Helper Functions for Groovy.

def loadData() {
        
        JSONObject json = new JSONObject();
        json.put("clearAllDataFlag", false);
        json.put("dataLoadValue", "ADD_EXISTING_VALUES");
        json.put("dataFileName", "BksML12C.txt");
        
        def url;
        def response;
	
        try {
                 url = new URL(serverUrl + "/epm/rest/" + apiVersion + "/applications/" + appName + "/jobs/essbaseDataLoadJob")
        } catch (MalformedURLException e) {
                 println "Malformed URL. Please pass valid URL"
                 System.exit(0);
        }         
        executeJob(url, "POST", json.toString());        
}