Export Template for Profitability and Cost Management

Exports Profitability and Cost Management applications as a template into the Outbox.

Required Roles

Service Administrator, Power User

REST Resource

POST/epm/rest/{api_version}/applications/{application}/jobs/templateExportJob?fileName={fileName}

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-19 Parameters

Name Description Type Required Default
api_version Version of the API you are developing with Path Yes None
application Name of the application Path Yes None
fileName Name of the template zip file to be exported to the outbox folder Query Yes None

Note:

If the file name is the same as an existing file name, this will override content in existing file.

Example URL and Payload

https://<BASE-URL>/epm/rest/v1/applications/BksML30/jobs/templateExportJob{"fileName":"testFile"}

Response

Supported Media Types: application/json

Table 24-20 Parameters

Name Description
details Task ID, such as BksML30_ExportTemplate_D20180201T210316_a80
status See Migration Status Codes
statusMessage Message about the status, such as In Progress
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_ExportTemplate_D20220511T114738_16e",
   "links":[
      {
         "href":"http://<BASE-URL>/epm/rest/v1/applications/jobs/ChecktaskStatusJob/BksML30_ExportTemplate_D20220511T114738_16e",
         "action":"GET",
         "rel":"Job Status"
      }
   ]
}

Java Sample – ExportTemplate.java for Profitability and Cost Management

Prerequisites: json.jar

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

    public void exportTemplate() throws Exception {
        String fileName = applicationName + "_Template_Export_File";
        
        JSONObject json = new JSONObject();
        json.put("fileName", fileName);
        
        String urlString = "%s/epm/rest/%s/applications/%s/jobs/templateExportJob";
        executeJob(urlString, "POST", json.toString());
        
    }
cURL Sample – ExportTemplate.sh for Profitability and Cost Management

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

funcExportTemplate() {
	fileName=$APP_NAME+"_Template_Export_File"
	param="{\"fileName\":\"$fileName\"}"
	url=$SERVER_URL/epm/rest/$API_VERSION/applications/$APP_NAME/jobs/templateExportJob
	funcExecuteRequest "POST" $url "$param" "application/json"

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

Groovy Sample – ExportTemplate.groovy for Profitability and Cost Management

Prerequisites: json.jar

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

def exportTemplate() {
        String fileName = appName + "_Template_Export_File";
        
        JSONObject json = new JSONObject();
        json.put("fileName", fileName);
        
        String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/applications/" + appName + "/jobs/templateExportJob";
                
        def url;    
        
        try {
                url = new URL(urlString)
        } catch (MalformedURLException e) {
                println "Malformed URL. Please pass valid URL"
                System.exit(0);
        }        
        executeJob(url, "POST", json.toString());        
}