Get Information About a Specific REST API Version for Migration
Returns information about a specific version.
Some Migration REST APIs are version 11.1.2.3.600, and others are other versions, such as v1 or v3. Passing the incorrect version will result in 404 errors when the API is invoked. Be sure to use the correct version for the API; api_version
could be 11.1.2.3.600
, v1
, or v2
.
Required Roles
Service Administrator, Power User, User, Viewer
REST Resource
GET /interop/rest/{api_version}
Request
Parameters:
The following table summarizes the client request.
Table 9-4 Parameters
Name | Description | Type | Default |
---|---|---|---|
api_version |
Specific API version | Path | Yes |
Response
Supported Media Types: application/json
Table 9-5 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 |
action |
The HTTP call type |
rel |
Possible values: self, recreate service |
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.
{
"status":0,
"details":null,
"links":[{
"data":null,
"action":"GET",
"href":"https://<BASE-URL/interop/rest/11.1.2.3.600",
"rel":"self"
},{
"data":null,
"action":"GET",
"href":"https://<BASE-URL>/interop/rest/11.1.2.3.600/services",
"rel":"recreate service"
},{
"data":null,
"action":"GET",
"href":"https://<BASE-URL>/interop/rest/11.1.2.3.600/applications",
"rel":"application service"
},{
"data":null,
"action":"GET", "href":"https://<BASE-URL>/interop/rest/11.1.2.3.600/applicationsnapshots "rel":"application snapshot service"
},{
"data":null,
"action":"POST",
"rel":"feedback services",
"href":"https://<BASE-URL>/interop/rest/11.1.2.3.600/feedback"
}]
}
Get Information about a Specific Version of Migration Sample Code
Example 9-4 Java Sample – getInfoAboutSpecificVersion.java
Prerequisites: json.jar
Common Functions: See Common Helper Functions for Java
//
// BEGIN - List version details
//
public void getLCMVersionDetails() throws Exception {
String urlString = String.format("%s/interop/rest/%s", serverUrl, apiVersion);
String response = executeRequest(urlString, "GET", null);
JSONObject json = new JSONObject(response);
int resStatus = json.getInt("status");
if (resStatus == 0) {
JSONArray linksArray = json.getJSONArray("links");
System.out.println("Version " + apiVersion + " details :");
JSONObject jObj = null;
for(int i=0; i < linksArray.length(); i++){
jObj = (JSONObject)linksArray.get(i);
System.out.println("Service :" + jObj.getString("rel"));
System.out.println("URL :" + jObj.getString("href"));
System.out.println("Action :" + jObj.getString("action") + "\n");
}
}
}
//
// END - List version details
//
Example 9-5 cURL Sample – GetInfoAboutSpecificVersion.sh
Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)
Common Functions: See Common Helper Functions for cURL
funcGetLCMVersionDetails() {
url=$SERVER_URL/interop/rest/$API_VERSION
funcExecuteRequest "GET" $url
output=`cat response.txt`
status=`echo $output | jq '.status'`
if [ $status == 0 ]; then
echo "Version $API_VERSION details :"
count=`echo $output | jq '.links | length'`
i=0
while [ $i -lt $count ]; do
echo "Service : " `echo $output | jq '.links['$i'].rel'`
echo "URL :" `echo $output | jq '.links['$i'].href'`
echo "Action :" `echo $output | jq '.links['$i'].action'`
echo ""
i=`expr $i + 1`
done
else
error=`echo $output | jq '.details'`
echo "Error occurred. " $error
fi
funcRemoveTempFiles "respHeader.txt" "response.txt"
}
Example 9-6 Groovy Sample – GetInfoAboutSpecificVersion.groovy
Prerequisites: json.jar
Common Functions: See CSS Common Helper Functions for Groovy
def getLCMVersionDetails() {
def url;
try {
url = new URL(serverUrl + "/interop/rest/" + apiVersion)
} 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 links = object.links
println "Version " + apiVersion + " details :"
links.each{
println "Service : " + it.rel
println "URL : " + it.href
println "Action : " + it.action + "\n"
}
} else {
println "Error occurred while fetching version details"
if (object.details != null)
println "Error details: " + object.details
}
}