Setting the Daily Maintenance Window Time

Use this REST API to set the daily maintenance window time. This API is version v1.

Note: To ensure that the use of this API does not interfere with the Oracle requirement for creating backups, this API will not change the maintenance start time if the daily maintenance process did not run in the last 36 hours.

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See About the REST APIs. Using these REST APIs requires prerequisites. See Prerequisites.

REST Resource

PUT /interop/rest/{api_version}/services/dailymaintenance?StartTime={N}

Parameters:

The following table summarizes the request parameters.

Table 7-4 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
StartTime Scheduled time for the maintenance window in 24 hour time format. The time will be implemented with respect to the existing time zone, where the value can be a number in the range 0 to 23. Query Yes None

Response

Supported Media Types: application/json

Table 7-5 Parameters

Parameters 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
action The HTTP call type
rel Possible value: self
data Parameters as key value pairs passed in the request

Example of Response Body

The following shows an example of the response body in JSON format.

{
"links": [1]
0:  {
"rel":"self",
"href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/v1/services/dailymaintenance?StartTime=23"
"data":"null",
"action":"PUT,
}-
-
"details":"null",
"status":"0"
}

Maintenance Window Time Sample Code

Example 7-4 Java Sample – SetMaintenanceDetails.java

Prerequisites: json.jar

Common Functions: See Common Helper Functions for Java

//
// BEGIN
//
public void setMaintenanceDetails () throws Exception {
	String urlString = String.format("%s/interop/rest/v1/services/dailymaintenance?StartTime=23", serverUrl);
	String response = executeRequest(urlString, "PUT", null);
	JSONObject json = new JSONObject(response);
	int resStatus = json.getInt("status");
	if (resStatus == 0) {
		System.out.println(“Updated successfully”);
	}
	
}
//
// END
//

Example 7-5 cURL Sample – SetMaintenanceDetails.sh

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

Common Functions: See Common Helper Functions for cURL

uncSetMaintenanceDetails () {
	rl=$SERVER_URL/interop/rest/v1/services/dailymaintenance?StartTime=23
	funcExecuteRequest "PUT" $url

	output='cat response.txt'
	status='echo $output | jq '.status''
	if [ $status == 0 ]; then
		echo "Updated Successfully"		
	else
		error='echo $output | jq '.details''
		echo "Error occurred. " $error
	fi
	funcRemoveTempFiles "respHeader.txt" "response.txt"
}

Example 7-6 Groovy Sample – SetMaintenanceDetails.groovy

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Groovy

def setMaintenanceDetails () {
	def url;
	try {
			url = new URL(serverUrl + "/interop/rest/v1/services/dailymaintenance?StartTime=23 ")
	} catch (MalformedURLException e) {
			println "Malformed URL. Please pass valid URL"
			System.exit(0);
	}
	response = executeRequest(url, "PUT", null);
	def object = new JsonSlurper().parseText(response)
	def status = object.status
	if (status == 0 ) {
		println “Updated Successfully”
	} else {
		println "Error occurred while listing versions"
		if (object.details != null)
				println "Error details: " + object.details
	}
}