Restart the Service Instance (v1)
Use the Restart the Service Instance (v1) REST API to restart the service instance with a REST API.
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 can also use an optional AutoTune parameter to auto-tune the environment before restarting it to ensure that Essbase index caches for Block Storage Option (BSO) cubes are optimized for your application.
This API is version v1.
Required Roles
Service Administrator
REST Resource
POST /interop/rest/{api_version}/services/{service_type}/resetservice
Note:
Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.
Request
Supported Media Types: application/json
Payload: JSON
Table 9-39 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 restart | Payload | Yes | None |
autotune |
If set to true , runs the auto tune algorithm
before the restart. This ensures that Essbase index caches for BSO
cubes are optimized for your application.
|
Payload | No | false |
Example of Request Body
{
"comment": "Reset requested by Administrator",
"autotune": "true"
}
Response
Table 9-40 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 reset 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/v1/services/PBCS/resetservice",
"rel":"self",
"data":null,
"action":"POST"
},{
"href":"https://<BASE-URL>/interop/rest/v1/services/PBCS/resetservice/777",
"rel":"Job Status",
"data":null,
"action":"GET"
}]
}
Restart the Service Sample Code
Example 9-15 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 reset 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 9-16 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 reset 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 9-17 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"
}
}