Run Recreate on a Service (11.1.2.3.600)

The Run Recreate on a Service (v11.1.2.3.600) REST API restores an environment to a clean state by recreating the deployment.

This topic describes the original version of this REST API. You can also use the simplified v2 version of the REST API. The v2 version contains all parameters in the payload and does not require URL encoding while calling the REST APIs. This makes the v2 API easier to use. The v2 version is backwards compatible.

You re-create the deployment to complete these tasks:

  • Clean up an environment before importing a full snapshot.
  • Change the business process that can be deployed in an environment.

Caution:

  • This API deletes the existing application and, optionally, all user defined artifacts from the environment. Additionally, it re-creates the database and removes all existing data. After recreating the service, you can create a new business process or import one using REST APIs, Migration, or EPM Automate.
  • This API deletes migration history. As a result, the Migration Status Report available in Migration will not contain historic information.
  • Before using this API, perform a complete backup of the environment. You can create a backup snapshot by executing runDailyMaintenance.

This API is version 11.1.2.3.600.

Required Roles

Service Administrator

REST Resource

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

Note:

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

Request

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

Table 9-43 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

Optionally, convert an environment to a different service environment. The business processes that you can deploy in an environment is governed by the type of subscription that you have. For example, if you have an EPM Standard Cloud Service subscription, you cannot create a FreeForm application after converting the environment from Account Reconciliation to Planning. If you have an EPM Enterprise Cloud Service subscription, you can create any business process in your environment after changing the service type appropriately. See "About the New Oracle Fusion Cloud EPM Services" in Getting Started Guide for Administrators.

The behavior of this parameter is dependent on your subscription. For details and examples, see Recreate in Working with EPM Automate.

Acceptable tempServiceType values:

  • ARCS to convert an environment to an Account Reconciliation environment
  • EDMCS to convert an environment to a Oracle Fusion Cloud Enterprise Data Management environment
  • EPCMC to convert an environment to an Enterprise Profitability and Cost Management environment
  • EPRCS to convert an environment to a Narrative Reporting environment
  • PCMCS to convert an environment to a Profitability and Cost Management environment
  • PBCS to convert a Profitability and Cost Management environment to a Planning or Enterprise Profitability and Cost Managementenvironment

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

When you run this REST API with tempserviceType, the serviceType change can be verified by making a REST call to /interop/rest.

Payload No None
removeAll If set to true, deletes all the snapshots and the content of the Inbox and Outbox folders Payload No None

Response

Table 9-44 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://<BASE-URL>/interop/rest/11.1.2.3.600/services/PBCS/recreate",
		"rel":"self",
		"data":null,
		"action":"POST"
		},{
		"href":"https://<BASE-URL>/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 9-18 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) 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("removeAll", removeAll);
	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 9-19 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\"}" | 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 9-20 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("removeAll", "true");
	      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");
	}
}
Common Functions