Deploy ML Cube

Deploys or redeploys the calculation cube for a selected Profitability and Cost Management application.

Required Roles

Service Administrator, Power User

REST Resource

POST /epm/rest/{api_version}/applications/{application}/jobs/ledgerDeployCubeJob

Note:

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.

Request

Supported Media Types: application/json

The following table summarizes the client request.

Table 24-11 Parameters

Name Description Type Required Default
api_version Version of the API you are developing with Path Yes None
application Name of the application for which to deploy the cube Path Yes None
isKeepData Specify whether to preserve existing data Payload Yes None
isReplaceCube

Specifies whether to replace existing cube

Note: Both isKeepData and isReplaceCube cannot be true at the same time.

Payload Yes None
isRunNow Run now or schedule for later. (Schedule for later is not currently supported.) Payload Yes None
comment Any user comments Payload Yes None

Example URL and Payload

https://<BASE-URL>/epm/rest/v1/applications/{applicationName}/jobs/ledgerDeployCubeJob

{"isKeepData":"true","isRunNow":"true","comment":"Test Ml Deploy"}

Response

Supported Media Types: application/json

Table 24-12 Parameters

Name Description
details In case of errors, details are published with the error string
status See Migration Status Codes
statusMessage Message about the status, such as In Progress
type Profitability
links Detailed information about the link
href Links to API call
action The HTTP call type
rel Relationship type
data Parameters as key value pairs passed in the request

Example of Response Body

The following shows an example of the response body in JSON format.

{
   "type":"Profitability",
   "status":-1,
   "statusMessage":"In Progress",
   "details":"BksML30_DeployCube_D20220511T114550_da1",
   "links":[
      {
         "href":"http://<BASE-URL>/epm/rest/v1/applications/jobs/ChecktaskStatusJob/BksML30_DeployCube_D20220511T114550_da1",
         "action":"GET",
         "rel":"Job Status"
      }
   ]
}

Java Sample – DeployCube.java for Profitability and Cost Management

Prerequisites: json.jar

Common Functions: See Profitability and Cost Management Common Helper Functions for Java

    public void deployCube() throws Exception {        
        JSONObject json = new JSONObject();
        json.put("isKeepData", true);
        json.put("isReplaceCube", false);
        json.put("isRunNow", true);
        json.put("comment", "Cube deployment");
        
        String urlString = "%s/epm/rest/%s/applications/%s/jobs/ledgerDeployCubeJob";
        executeJob(urlString, "POST", json.toString());        
    }

cURL Sample – DeployCube.sh for Profitability and Cost Management

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

funcDeployCube() {
	comment="Cube deployment Curl"
	param="{\"isKeepData\":\"false\",\"isReplaceCube\":\"true\",\"isRunNow\":\"true\",\"comment\":\"$comment\"}"
	url=$SERVER_URL/epm/rest/$API_VERSION/applications/$APP_NAME/jobs/ledgerDeployCubeJob
	funcExecuteRequest "POST" $url "$param" "application/json"

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

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());        
}