Run ML Rule Balancing

Retrieves Rule Balancing data for a particular POV for a given application.

Required Roles

Service Administrator, Power User

REST Resource

GET /epm/rest/{api_version}/applications/{application}/povs/{povGroupMember}/ruleBalance

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-37 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 retrieve rule balancing data Path Yes None
povGroupMember POV name for which to retrieve the results, such as 2015_January_Actual Path Yes None
modelViewName Model view name to filter the results within the POV area Query Yes None
stringDelimiter String delimiter for POV group members, such as "_" Query No Underscore, "_"

Example URL and Sample Query Parameter

https://<BASE-URL>/epm/rest/{api_version}/applications/{application}/povs/{povGroupMembers}/ruleBalance?queryParameter={"modelViewName":"modelViewName"}

Response

Supported Media Types: application/json

Table 24-38 Parameters

Name Description
details

Rule balancing output for the given POV

status See Migration Status Codes
statusMessage Message about the status, such as Success
type Profitability
data Parameters as key value pairs
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.

"items": [{
      "ruleNumber": "",
      "rules": [],
      "balanceTypeRule": true,
      "scale": 2,
      "sequence": 0,
      "name": "NoRule",
      "description": null,
      "runningBalance": 49357098.03,
      "balance": 49357098.03,
      "allocationIn": null,
      "allocationOut": null,
      "adjustmentIn": null,
      "adjustmentOut": null,
      "input": 49357098.03,
      "runningRemainder": 49357098.03,
      "remainder": 49357098.03,
      "netChange": null,
      "offset": null,
      "inputAsString": "49,357,098.03",
      "adjInAsString": "-",
      "adjOutAsString": "-",
      "allocInAsString": "-",
      "allocOutAsString": "-",
      "balanceAsString": "49,357,098.03",
      "runningBalanceAsString": "49,357,098.03",
      "runningRemainderAsString": "49,357,098.03",
      "remainderAsString": "49,357,098.03",
      "netChangeAsString": "-",
      "offsetAsString": "-"
    },    
  ],
  "type": "Profitability",
"status": 0,
  "details": "",
  "statusMessage": "Success"
}

Java Sample – RunRuleBalancing.java for Profitability and Cost Management

Prerequisites: json.jar

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

public void runRuleBalancing() throws Exception {
        
        String modelViewName = null;
        
        JSONObject json = new JSONObject();        
        json.put("stringDelimiter", "_");        
        json.put("modelViewName", modelViewName);
        
        String povGroupMember = "2014_January_Actual";
        
        String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/applications/" + applicationName + "/povs/" 
                                       + povGroupMember.trim().replaceAll(" ", "%20") + "/ruleBalance";
        urlString = urlString + "?" + "queryParameter=" + json.toString();
        
        String response = executeRequest(urlString, "GET", null, "application/json");
        JSONObject jsonObj = new JSONObject(response);
        int resStatus = jsonObj.getInt("status");
        
        if(resStatus == 0) {
            System.out.println("Rule Balancing ran successfully");
            JSONArray itemsArray = jsonObj.getJSONArray("items");        
            System.out.println("Details : " + itemsArray.toString());
        } else {
            String details = jsonObj.getString("details");
            System.out.println("Rule Balancing failed. Details : " + details);
        }        
        
    }

cURL Sample – RunRuleBalancing.sh for Profitability and Cost Management

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

funcRunRuleBalancing() {
	url=$SERVER_URL/epm/rest/$API_VERSION/applications/$APP_NAME/povs/$POV_GROUP_MEMBER/ruleBalance
	funcExecuteRequest "GET" $url "application/x-www-form-urlencoded"
	list=`cat response.txt | jq 'select(.items != null) | .items[].name'`
	if [[ ! -z $list ]]; then
		echo $list
	else
		echo "No Items found"
	fi
	funcRemoveTempFiles "respHeader.txt" "response.txt"

}

Groovy Sample – RunRuleBalancing.groovy for Profitability and Cost Management

Prerequisites: json.jar

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

def runRuleBalancing() {        
        
        String modelViewName = null;
        
        JSONObject json = new JSONObject();        
        json.put("stringDelimiter", "_");        
        json.put("modelViewName", modelViewName);
        
        String povGroupMember = "2014_January_Actual";       
        
        def url;
        def response;
        
        String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/applications/" + appName + "/povs/" 
                                       + povGroupMember.trim().replaceAll(" ", "%20") + "/ruleBalance";
        urlString = urlString + "?" + "queryParameter=" + json.toString();
        
        try {
                url = new URL(urlString);
        } catch (MalformedURLException e) {
                println "Malformed URL. Please pass valid URL"
                System.exit(0);
        }       
        
        response = executeRequest(url, "GET", null, "application/json");
        JSONObject jsonObj = new JSONObject(response);
        int resStatus = jsonObj.getInt("status");
        
        if(resStatus == 0) {
            println "Rule Balancing ran successfully"
            JSONArray itemsArray = jsonObj.getJSONArray("items");        
            println "Details : " + itemsArray.toString()
        } else {
            String details = jsonObj.getString("details");
            println "Rule Balancing failed. Details : " + details
        }     
    }