Run Recreate on a Service

Uses a REST API to restore an environment to a clean state by refreshing the deployment.

Restores an environment to a clean state by refreshing the deployment. This process deletes the existing application and all user defined artifacts from the environment. After recreating the service, you can create a new application or import an application using Migration or EPM Automate. You can use the optional EssbaseChange parameter to upgrade or downgrade the current Essbase version in legacy Oracle Financial Consolidation and Close Cloud, Oracle Enterprise Planning and Budgeting Cloud, and Planning and Budgeting Cloud Plus 1 environments.

This REST API is version 11.1.2.3.600.

REST Resource

GET /interop/rest/{api_version}/services/{servicename}/recreate

Request

Supported Media Types: application/x-www-form-urlencoded

Parameters:

The following table summarizes the client request.

Table 6-17 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
servicename Name of the service for which recreate needs to be run, such as PBCS Path Yes None
tempServiceType
Optional parameter to temporarily convert a Planning environment to a different service environment. This parameter takes the following as the tempServiceType value:
  • ARCS converts the environment to an Oracle Account Reconciliation Cloud environment
  • EDMCS converts the environment to an Oracle Enterprise Data Management Cloud environment
  • EPRCS converts the environment to an Oracle Narrative Reporting environment
  • PCMCS converts the environment to an Oracle Profitability and Cost Management Cloud environment

Note: You can create an Oracle Tax Reporting Cloud or Oracle Financial Consolidation and Close Cloud application in a new Planning environment. You do not need to change the service type of the environment.

Payload No None
removeAll If set to true, deletes all the snapshots and the content of the Inbox and Outbox folders Payload No None
essbaseChange Upgrade or downgrade the current Essbase version in legacy Oracle Financial Consolidation and Close Cloud, Oracle Enterprise Planning and Budgeting Cloud, and Planning and Budgeting Cloud Plus 1 environments.

Values: upgrade, downgrade

Payload No None

Response

Parameters:

Table 6-18 Parameters

Name Description
details In case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call or status API
action The HTTP call type
rel

Possible values: self and/or Job Status.

If the value is set to Job Status, you can use the href to get the status of the recreate service

data Parameters as key value pairs passed in the request

Example of Response Body

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

{
	"details":null,
	"status":0,
	"links":[{
		"href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/services/PBCS/recreate",
		"rel":"self",
		"data":null,
		"action":"POST"
		},{
		"href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/services/PBCS/recreate/777",
		"rel":"Job Status",
		"data":null,
		"action":"GET"
	}]
}

Run Recreate on a Service Sample Code

Example 6-17 Java Sample – runRecreateOnAService.java

Prerequisites: json.jar

Common Functions: See Common Helper Functions for Java

//
// BEGIN - Recreate services
//
public void recreateService(String serviceName, String serviceType, String removeAll, String essbaseChange) throws Exception {
	Scanner in = new Scanner(System.in);
	System.out.println("Are you sure you want to recreate the EPM environment (yes/no): no ?[Press Enter]");
	String s = in.nextLine();
	if (!s.equals("yes")) {
		System.out.println("User cancelled the recreate command");
		System.exit(0);
	}

	

JSONObject params = new JSONObject();
//params.put("tempServiceType", serviceType);
params.put("removeAll", removeAll);
params.put("essbaseChange", essbaseChange);
	String parameters = "parameters="+ URLEncoder.encode(params.toString(), "UTF-8");
	String urlString = String.format(				"%s/interop/rest/%s/services/%s/recreate", serverUrl, apiVersion, serviceName);
	String response = executeRequest(urlString, "POST", parameters, "application/x-www-form-urlencoded");
	getJobStatus(fetchPingUrlFromResponse(response, "Job Status"),"GET");
}

//
// END - Recreate services
//

Example 6-18 cURL Sample – RunRecreateOnAService.sh

Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)

Common Functions: See Common Helper Functions for cURL

funcRecreateService() {
        echo "Are you sure you want to recreate the EPM environment (yes/no): no ?[Press Enter]"
        read toCreate
        if [ $toCreate != "yes" ]; then
                echo "User cancelled the recreate command"
                exit 0
        fi

        url=$SERVER_URL/interop/rest/$API_VERSION/services/EPM/recreate
        json=$(echo "{\"removeAll\":\"true\",\"essbaseChange\":\"upgrade\"}" | sed -f urlencode.sed)
        param="parameters=$json"
        funcExecuteRequest "POST" $url $param "application/x-www-form-urlencoded"
        output=`cat response.txt`
        status=`echo $output | jq '.status'`
    if [ $status == -1 ]; then
        echo "Started recreating the environment successfully"
                funcGetStatus "GET"
    else
        error=`echo $output | jq '.details'`
        echo "Error occurred. " $error
    fi
        funcRemoveTempFiles "respHeader.txt" "response.txt"
}

Example 6-19 Groovy Sample – RunRecreateOnAService.groovy

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Groovy

def recreateService(serviceName) {
	def toCreate = System.console().readLine 'Are you sure you want to recreate the EPM environment (yes/no): no ?[Press Enter]'
	if (!toCreate.equals("yes")) {
		println "User cancelled the recreate command"
		System.exit(0)
	}
	def url;
	JSONObject params = new JSONObject();
	try {
            //params.put("tempServiceType",serviceType);
	      params.put("removeAll", "true");
	      params.put("essbaseChange", "upgrade");
		url = new URL(serverUrl + "/interop/rest/" + apiVersion + "/services/" + serviceName + "/recreate");
	} catch (MalformedURLException e) {
			println "Malformed URL. Please pass valid URL"
			System.exit(0);
	}
	response = executeRequest(url, "POST", "parameters="+param.toString(), "application/x-www-form-urlencoded");
	if (response != null) {
		getJobStatus(response,"GET");
	}
}