Setting the Daily Maintenance Time (v1)

Use this REST API (v1) to set the daily maintenance window start time.

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.

Use this REST API to set the daily maintenance window time.

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 this REST API requires prerequisites. See Prerequisites.

This API is version v1.

Required Roles

Service Administrator

REST Resource

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

Parameters:

The following table summarizes the request parameters.

Table 11-6 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
StartTime Scheduled Time (in HH:00 format using a 24 hour clock) at which the maintenance process should start and an optional time zone. Acceptable start time value range is 00:00 - 23:00. If the start time is not to be set in UTC, specify a valid standard time zone; for example, "14:00 America/Los_Angeles" for 2:00 pm Pacific Standard Time. Query Yes None

Response

Supported Media Types: application/json

Table 11-7 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 11-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 11-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 11-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
	}
}