Restart the Service Instance

Restarts the service instance.

This REST API is version 11.1.2.3.600.

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

Response

Parameters:

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

Example of Response Body

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

{
	"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));

	String urlString = String.format("%s/interop/rest/%s/services/PBCS/resetservice", serverUrl, lcmVersion);
	String response = executeRequest(urlString, "POST", params.toString(), "application/x-www-form-urlencoded");
	waitForCompletion(fetchPingUrlFromResponse(response, "Job Status"));
}
//
// 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\"}"
	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);
			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) {
			waitForCompletion(fetchPingUrlFromResponse(response, "Job Status"));
		}	
	} else {
		println "User cancelled the resetservice command"
	}
}