Get the Build Version and Daily Maintenance Time (v1)

This API (v1) returns information about the current build version and the scheduled daily maintenance window 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.

This API is version v1.

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.

Required Roles

Service Administrator

REST Resource

GET /interop/rest/{api_version}/services/dailymaintenance

The following table summarizes the request parameters.

Table 11-2 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None

Response

Supported Media Types: application/json

Table 11-3 Parameters

Parameters Description
details In case of errors, details are published with the error string
status See Migration Status Codes
items Detailed information about the API
amwTime Scheduled start time of the daily maintenance window in 24-hour format in Etc/UTC timezone by default or in the specified time zone when the "showTimeZone" optional parameter is true.
buildVersion Current build version
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.

{
"details":null,
"links":[
{
"rel":"self","href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/v1/services/dailymaintenance",
"data":"null",
"action":"GET"}],
"status":"0",
"items":[
{
"amwTime":"19",
"buildVersion":"16.10.17"}
]
}

Get Build Version and Daily Maintenance Time Sample Code

Example 11-1 Java Sample – GetMaintenanceDetails.java

Prerequisites: json.jar

Common Functions: See Common Helper Functions for Java

//
// BEGIN
//
public void getMaintenanceDetails () throws Exception {
	String urlString = String.format("%s/interop/rest/v1/services/dailymaintenance", serverUrl);
	String response = executeRequest(urlString, "GET", null);
	JSONObject json = new JSONObject(response);
	int resStatus = json.getInt("status");
	if (resStatus == 0) {
		JSONArray fileList = json.getJSONArray("items");
		System.out.println("List of items are :");
		JSONObject jObj = null;
		for(int i=0; i<fileList.length(); i++){
			jObj = (JSONObject)fileList.get(i);
			System.out.println("build version :" + jObj.getString("buildVersion"));
			System.out.println("AMW time :" + jObj.getString("amwTime"));
			System.out.println("Link :" + ((JSONObject) ((JSONArray)json.getJSONArray("links")).get(0)).getString("href") + "\n");
		}
	}
}
//
// END
//

Example 11-2 cURL Sample – GetMaintenanceDetails.sh

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

Common Functions: See Common Helper Functions for cURL

funcGetMaintenanceDetails () {
	url=$SERVER_URL/interop/rest/v1/services/dailymaintenance
	funcExecuteRequest "GET" $url

	output=`cat response.txt`
	status=`echo $output | jq '.status'`
	if [ $status == 0 ]; then
		echo "List of items :"
		count=`echo $output | jq '.items | length'`
		i=0
		while [ $i -lt $count ]; do
			echo "Build Version : " `echo $output | jq '.items['$i'].buildVersion'`
			echo "AMW Time :" `echo $output | jq '.items['$i'].amwTime`
			echo "Link :" `echo $output | jq '.links[0].href'`
			echo ""
			i=`expr $i + 1`
		done
	else
		error=`echo $output | jq '.details'`
		echo "Error occurred. " $error
	fi
	funcRemoveTempFiles "respHeader.txt" "response.txt"
}

Example 11-3 Groovy Sample – GetMaintenanceDetails.groovy

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Groovy

def getMaintenanceDetails () {
	def url;
	try {
			url = new URL(serverUrl + "/interop/rest/v1/services/dailymaintenance ")
	} catch (MalformedURLException e) {
			println "Malformed URL. Please pass valid URL"
			System.exit(0);
	}
	response = executeRequest(url, "GET", null);
	def object = new JsonSlurper().parseText(response)
	def status = object.status
	if (status == 0 ) {
		def items = object.items
		println "List of items :"
		items.each{
			println "Build Version : " + it.buildVersion
			println "AMW Time : " + it.amwTime
			println "Link : " + it.links[0].href + "\n"
		}
	} else {
		println "Error occurred while listing versions"
		if (object.details != null)
				println "Error details: " + object.details
	}
}
Common Functions