Groovy Sample – DeployCube.groovy for Profitability and Cost Management

Prerequisites: json.jar

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

def deployCube() {
        
        JSONObject json = new JSONObject();
        json.put("isKeepData", true);
        json.put("isReplaceCube", false);
        json.put("isRunNow", true);
        json.put("comment", "Cube deployment");     
        
        def url;
        def response;
	
        try {
                 url = new URL(serverUrl + "/epm/rest/" + apiVersion + "/applications/" + appName + "/jobs/ledgerDeployCubeJob")
        } catch (MalformedURLException e) {
                println "Malformed URL. Please pass valid URL"
                System.exit(0);
       }
        
        executeJob(url, "POST", json.toString());        
}