Run Recreate on a Service (v2)
Use this API to restore an environment to a clean state by recreating the deployment.
This topic describes the simplified v2 version of this REST API. This 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. This API is backwards compatible.
Before using the REST resources, you must understand how to access the REST resources and other important concepts. See About the REST APIs. Using this REST API requires prerequisites. See Prerequisites.
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.
Required Roles
Service Administrator
REST Resource
POST /interop/rest/v2/config/services/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/json
Payload: JSON
Table 9-43 Parameters
| Name | Description | Type | Required | Default |
|---|---|---|---|---|
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
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 |
Payload | No | None |
removeAll |
If set to true, deletes all the snapshots, the
content of the Inbox and Outbox folders, and the archived snapshots
in Oracle Object Storage. Default is false, which
retains the snapshots and the content of inbox and outbox. After
this API is issued on an environment with
removeAll=true, the behavior of these EPM
Automate commands will be as follows:
|
Payload | No | None |
Example of Request Payload
{
"parameters": {
"removeAll": "true",
"tempServiceType": "SERVICE_TYPE"
}
}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: 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
{
"details": null,
"status": 0,
"links": [{
"href": "https://<BASE-URL>/interop/rest/v2/config/services/recreate",
"rel": "self",
"data": null,
"action": "POST"
},
{
"href": "https://<BASE-URL>/interop/rest/v2/config/status/service/recreate/1",
"rel": "Job Status",
"data": null,
"action": "GET"
}]
}Sample cURL command
curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' -d ‘"{"parameters":{"removeAll":"false", "tempServiceType":"<SERVICE-TYPE>"}}"' 'https://<BASE-URL>/interop/rest/v2/config/services/recreate
Sample cURL Code
#!/bin/sh
USERNAME="<USERNAME>"
PASSWORD="<PASSWORD>"
SERVER_URL="<SERVICE_URL>"
APP_NAME="Vision"
API_VERSION="v2"
funcRemoveTempFiles() {
for var in "$@"
do
if [ -f $var ]; then
rm $var
fi
done
}
funcPrintErrorDetails() {
contentType=`echo $(grep 'Content-Type:' respHeader.txt) | tr -d [:space:]`
if [ ! -z $contentType ] && [[ $contentType = *"application/json"* ]]; then
output=`cat $1`
error=`echo $output | jq '.details'`
echo "Error details: " $error
fi
}
funcExecuteRequest() {
if [ ! -z "$4" ]; then
statusCode=`curl -X $1 -s -w "%{http_code}" -u "$USERNAME:$PASSWORD" -o "response.txt" -D "respHeader.txt" -H "Content-Type: $4" -d "$3" $2`
else
statusCode=`curl -X $1 -s -w "%{http_code}" -u "$USERNAME:$PASSWORD" -o "response.txt" -D "respHeader.txt" -H "Content-Type: $3" $2`
fi
if [ $statusCode != 200 ]; then
echo "Error executing request"
if [ $statusCode != 000 ]; then
echo "Response error code : " $statusCode
funcPrintErrorDetails "response.txt"
funcRemoveTempFiles "respHeader.txt" "response.txt"
fi
exit 0
fi
}
funcGetStatus() {
output=`cat response.txt`
count=`echo $output | jq '.links | length'`
i=0
pingUrl=""
while [ $i -lt $count ]; do
rel=`echo $output | jq '.links['$i'].rel'`
rel=`echo "$rel" | tr -d "\""`
if [ "$rel" == "Job Status" ]; then
pingUrl=`echo $output | jq '.links['$i'].href'`
pingUrl=`echo "$pingUrl" | tr -d "\""`
fi
i=`expr $i + 1`
done
echo $pingUrl
completed="false"
while [ $completed != "true" ]; do
statusCode2=`curl -X $1 -s -w "%{http_code}" -u "$USERNAME:$PASSWORD" -o "pingResponse.txt" -H "Content-Type: application/json" "$pingUrl"`
if [ $statusCode2 == 200 ]; then
status2=`jq '.status' pingResponse.txt`
if [ $status2 != -1 ]; then
completed="true"
echo "Job completed"
else
echo "Please wait..."
sleep 20
fi
else
echo "Please wait..."
sleep 20
fi
funcRemoveTempFiles "pingResponse.txt"
done
}
funcHardReset() {
echo "Are you sure you want to restart the service instance (yes/no): no? [Press Enter] "
read toReset
if [ $toReset != "yes" ]; then
echo "User cancelled the reset command"
exit 0
fi
url=$SERVER_URL/interop/rest/$API_VERSION/config/services/reset
comment=$(echo $1)
param="{\"comment\":\"${comment}\",\"parameters\":{\"autotune\":\"false\"}}"
funcExecuteRequest "POST" "$url" "$param" "application/json"
output=`cat response.txt`
status=`echo $output | jq '.status'`
if [ "${status}" == -1 ]; then
echo "Started hard reset succesfully"
funcGetStatus "GET"
else
error=`echo $output | jq '.details'`
echo "Error occurred. " $error
fi
funcRemoveTempFiles "respHeader.txt" "response.txt"
}
funcRecreateService() {
removeAll=$1
essbaseChange=$2
tempServiceType=$3
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/config/services/recreate
param="{\"parameters\":{\"removeAll\":\"${removeAll}\",\"essbaseChange\":\"${essbaseChange}\", \"tempServiceType\":\"${tempServiceType}\"}}"
funcExecuteRequest "POST" "$url" "$param" "application/json"
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"
}
if [[ "$#" != "1" ]]; then
echo "Mandatory argument missing"
echo "Usage: EPMRestSamples <option>"
echo " where <option> is -recreate or -reset"
exit 1
fi
if [ "${1}" == "-reset" ]; then
funcHardReset "POC Exit Criteria Check - cURL"
elif [ "${1}" == "-recreate" ]; then
funcRecreateService "false" "default" ""
else
echo "Incorrect usage"
echo "Usage: EPMRestSamples <option>"
echo " where <option> is -recreate or -reset"
exit 1
fi