Create File-Based Application
Creates an application using a flat file using a REST API.
Required Roles
Service Administrator
REST Resource
POST /epm/rest/{api_version}/fileApplications/{application}
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-9 Parameters
Name | Description | Type | Required | Default |
---|---|---|---|---|
api_version |
Version of the API you are developing with | Path | Yes | None |
application |
Name of the application to create | Path | Yes | None |
description |
User comment for this application | Payload | Yes | None |
ruleDimensionName |
Rule dimension name | Payload | Yes | None |
balanceDimensionName |
Balance dimension name | Payload | Yes | None |
Example URL and Payload
https://<BASE-URL>/epm/rest/v1/fileApplications/BksML12
{"description": "description","ruleDimensionName":"Rule","balanceDimensionName":"Balance"}
Response
Supported Media Types: application/json
Table 24-10 Parameters
Name | Description |
---|---|
details |
Task ID, such as BksML12_BksML12_LoadData_D20160118T051020_ba8_1 |
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.
{
"type":"Profitability",
"status":-1,
"statusMessage":"In Progress",
"details":"BksML30_UpdateDimensions_D20220513T062046_c61",
"links":[
{
"href":"http://<<BASE-URL>/epm/rest/v1/applications/jobs/ChecktaskStatusJob/BksML30_UpdateDimensions_D20220513T062046_c61",
"action":"GET",
"rel":"Job Status"
}
]
}
Java Sample – CreateFlatFileApplication.java for Profitability and Cost Management
Prerequisites: json.jar
Common Functions: See Profitability and Cost Management Common Helper Functions for Java
public void createFlatFileApplication() throws Exception {
JSONObject json = new JSONObject();
json.put("description", "Flat file based application");
json.put("ruleDimensionName", "Rule");
json.put("balanceDimensionName", "Balance");
String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/fileApplications/" + "BksML13";
String response = executeRequest(urlString, "POST", json.toString(), "application/json");
JSONObject jsonObj = new JSONObject(response);
int resStatus = jsonObj.getInt("status");
if(resStatus == 0) {
System.out.println("Application created successfully");
} else {
System.out.println("Application creation failed");
}
}
cURL Sample – CreateFlatFileApplication.sh for Profitability and Cost Management
Common Functions: See Profitability and Cost Management Common Helper Functions for cURL.
funcCreateFlatFileApplication() {
description="Flat file based application";
ruleDimensionName="Rule"
balanceDimensionName="Balance"
param="{\"description\":\"$description\",\"ruleDimensionName\":\"$ruleDimensionName\",\"balanceDimensionName\":\"$balanceDimensionName\"}"
url=$SERVER_URL/epm/rest/$API_VERSION/fileApplications/BksML13
funcExecuteRequest "POST" $url "$param" "application/json"
output=`cat response.txt`
status=`echo $output | jq '.status'`
if [ $status == 0 ]; then
echo "Application created successfully"
else
error=`echo $output | jq '.details'`
echo "Error occurred. " $error
fi
funcRemoveTempFiles "respHeader.txt" "response.txt"
}
Groovy Sample – CreateFlatFileApplication.groovy for Profitability and Cost Management
Prerequisites: json.jar
Common Functions: See Appendix C: Common Helper Functions for Groovy.
def createFlatFileApplication() {
JSONObject json = new JSONObject();
json.put("description", "Flat file based application");
json.put("ruleDimensionName", "Rule");
json.put("balanceDimensionName", "Balance");
String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/fileApplications/" + "BksML13";
def url;
try {
url = new URL(urlString)
} catch (MalformedURLException e) {
println "Malformed URL. Please pass valid URL"
System.exit(0);
}
String response = executeRequest(url, "POST", json.toString(), "application/json")
JSONObject jsonObj = new JSONObject(response);
int resStatus = jsonObj.getInt("status");
if(resStatus == 0) {
println "Application created successfully"
} else {
println "Application creation failed"
}
}