Restart the Service Instance

Restarts the service instance with a REST API.

You can also add a comment to indicate the reason for the restart. You can also use an optional AutoTune parameter to auto-tune the environment before restarting it to ensure that Essbase caches are optimized for your application.

This REST API is version v1.

REST Resource

POST /interop/rest/{api_version}/services/{service_type}/resetservice

Request

Supported Media Types: application/json

The following table summarizes the client request.

Table 6-19 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
service_type Value for the service type. Service type can be one of the following: PBCS for Planning and Budgeting, EPBCS for Enterprise Planning and Budgeting, FCCS for Financial Consolidation and Close, TRCS for Tax Reporting, EDMCS for Enterprise Data Management, PCMCS for Profitability and Cost Management, or ARCS for Account Reconciliation. Path Yes None
comment Comment about executing the reset Payload Yes N/A
Autotune If set to true, runs the auto tune algorithm before the restart. This ensures that Essbase caches are optimized for your application. Payload No false

The Payload is JSON.

Example of Request Body:

{
  "comment": "Reset requested by Administrator"
}

Request

The payload is JSON.

Example of request body:

{
  "comment": "Reset requested by Administrator",
  "autotune": "true"
}

Response

Table 6-20 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

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

{
	"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/resetservice",
		"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/resetservice/777",
		"rel":"Job Status",
		"data":null,
		"action":"GET"
	}]
}

Restart the Service Sample Code

Example 6-20 Java Sample – ResetServices.java

Prerequisites: json.jar

Common Functions: See Common Helper Functions for Java

//
// BEGIN - Reset services
//
public void hardReset(String comment) throws Exception {
	Scanner in = new Scanner(System.in);
	System.out.println("Are you sure you want to restart the service instance (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("comment",java.net.URLEncoder.encode(comment));
      params.put("autotune","true");
	String urlString = String.format("%s/interop/rest/%s/services/PBCS/resetservice", serverUrl, lcmVersion);
	String response = executeRequest(urlString, "POST", params.toString(), "application/json");
	getJobStatus(fetchPingUrlFromResponse(response, "Job Status"),"GET");
}
//
// END - Reset services
//

Example 6-21 cURL Sample – ResetServices.sh

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

Common Functions: See Common Helper Functions for cURL

funcHardReset() {
	echo "Are you sure you want to restart the service instance (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/$LCM_VERSION/services/PBCS/resetservice
	comment=$(echo $1 | sed -f urlencode.sed)
	param="{\"comment\":\"$comment\",\"autotune\":\"true\"}"
	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"
}

Example 6-22 Groovy Sample – ResetServices.groovy

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Groovy

def hardReset(comment) {
	def userInput = System.console().readLine 'Are you sure you want to restart the service instance (yes/no): no ?[Press Enter] '
	if (userInput.equals("yes")) {
		def url;
		JSONObject params = new JSONObject();
		try {
			params.put("comment",comment);
			params.put("autotune","true");
			url = new URL(serverUrl + "/interop/rest/" + lcmVersion + "/services/PBCS/resetservice");
		} catch (MalformedURLException e) {
			println "Malformed URL. Please pass valid URL"
			System.exit(0);
		}
		response = executeRequest(url, "POST", params.toString(), "application/json");

		response = executeRequest(url, "POST", payload);
		if (response != null) {
			getJobStatus(fetchPingUrlFromResponse(response, "Job Status"),"GET");
		}	
	} else {
		println "User cancelled the resetservice command"
	}
}