Get Information About a Specific Application Snapshot
Returns information about all the operations that can be performed on a particular application snapshot. It provides details on operations such as Migration import and export, upload, download, and delete.
This API is version 11.1.2.3.600.
Required Roles
Service Administrator
REST Resource
GET /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName}
Request
The following table summarizes the GET request parameters.
Table 9-49 Parameters
Name | Description | Type | Required | Default |
---|---|---|---|---|
applicationSnapshotName |
Application snapshot name to retrieve the details | Path | Yes | N/A |
Response
Supported Media Types: application/json
Table 9-50 Parameters
Name | Description |
---|---|
details |
In the case of an error, details are published with the error string |
status |
See Migration Status Codes |
items |
Detailed information about the API |
name |
Name of the application snapshot |
type |
Possible values: LCM , EXTERNAL |
canexport |
Identifies whether this application snapshot can be exported using Migration. Applicable only to Migration application artifacts |
canimport |
Identifies whether this application snapshot can be imported using Migration. Applicable only to Migration application artifacts |
canupload |
Identifies whether the application snapshot can be uploaded |
candownload |
Identifies whether the application snapshot can be downloaded |
links |
Detailed information about the link |
href |
Links to API call |
action |
The HTTP call type |
rel |
Possible values: self , import , export , upload , download , or delete depending on the operation permitted on an application snapshot
|
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.
{
"status":0,
"items":[{
"name":"snapshot1",
"type":"LCM",
"canexport":true,
"canimport":true,
"canupload":true,
"candownload":true
}],
"details":null,
"links":[{
"data":null,
"action":"GET",
"href":"https://<BASE URL>/interop/rest/11.1.2.3.600/applicationsnapshots/snapshot1",
"rel":"self"
},{
"data":null,
"action":"GET",
"href":"https://<BASE URL>/interop/rest/11.1.2.3.600/applicationsnapshots/snapshot1/contents",
"rel":"download"
},{
"data":null,
"action":"POST",
"href":"https://<BASE URL>/interop/rest/11.1.2.3.600/applicationsnapshots/snapshot1/contents?isLast=true&chunkSize=52428800&isFirst=true",
"rel":"upload"
},{
"data":null,
"action":"POST",
"href":"https://<BASE URL>/interop/rest/11.1.2.3.600/applicationsnapshots/snapshot1/migrationq={type:"export}"
"rel":"export"
},{
"data":null,
"action":"POST",
"href":"https://<BASE URL>/interop/rest/11.1.2.3.600/applicationsnapshots/snapshot1/migrationq={type:"import}",
"rel":"import"
},{
"data":null,
"action":"DELETE",
"href":"https://<BASE URL>/interop/rest/11.1.2.3.600/applicationsnapshots/ss1",
"rel":"delete"
}]
}
Java Sample – getInfoAboutSpecificSnapshots.java
Prerequisites: json.jar
Common Functions: See Common Helper Functions for Java
//
// BEGIN - Get application snapshot details
//
public void getApplicationSnapshotDetails(String snapshotName) throws Exception {
String urlString = String.format("%s/interop/rest/%s/applicationsnapshots/%s", serverUrl, apiVersion, snapshotName);
String response = executeRequest(urlString, "GET", null);
JSONObject json = new JSONObject(response);
int resStatus = json.getInt("status");
if (resStatus == 0) {
System.out.println("Application details :");
JSONArray itemsArray = json.getJSONArray("items");
JSONObject item = (JSONObject) itemsArray.get(0);
System.out.println("Application snapshot name : " + item.getString("name"));
System.out.println("Application snapshot type : " + item.getString("type"));
System.out.println("Can be exported flag : " + item.getString("canExport"));
System.out.println("Can be imported flag : " + item.getString("canImport"));
System.out.println("Can be uploaded flag : " + item.getString("canUpload"));
System.out.println("Can be downloaded flag : " + item.getString("canDownload"));
JSONArray linksArray = json.getJSONArray("links");
JSONObject jObj = null;
System.out.println("Services details :");
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 - Get application snapshot details
//
cURL Sample – GetInfoAboutSpecificSnapshots.sh
Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)
Common Functions: See Common Helper Functions for cURL
funcGetApplicationSnapshotDetails() {
url=$SERVER_URL/interop/rest/$API_VERSION/applicationsnapshots/$1
funcExecuteRequest "GET" $url
output=`cat response.txt`
status=`echo $output | jq '.status'`
if [ $status == 0 ]; then
echo "Application details :"
echo "Application snapshot name : " `echo $output | jq '.items[0].name'`
echo "Application snapshot type : " `echo $output | jq '.items[0].type'`
echo "Can be exported flag : " `echo $output | jq '.items[0].canExport'`
echo "Can be imported flag : " `echo $output | jq '.items[0].canImport'`
echo "Can be uploaded flag : " `echo $output | jq '.items[0].canUpload'`
echo "Can be downloaded flag : " `echo $output | jq '.items[0].canDownload'`
count=`echo $output | jq '.links | length'`
i=0
echo "Services details :"
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"
}
Groovy Sample – GetInfoAboutSpecificSnapshots.groovy
Prerequisites: json.jar
Common Functions: See CSS Common Helper Functions for Groovy
def getApplicationSnapshotDetails(applicationSnapshotName) {
def url;
try {
String snapshotName = URLEncoder.encode(applicationSnapshotName, "UTF-8");
url = new URL(serverUrl + "/interop/rest/" + apiVersion + "/applicationsnapshots/" + snapshotName)
} 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 ) {
println "Application details :"
println "Application snapshot name : " + object.items[0].name
println "Application snapshot type : " + object.items[0].type
println "Can be exported flag : " + object.items[0].canExport
println "Can be imported flag : " + object.items[0].canImport
println "Can be uploaded flag : " + object.items[0].canUpload
println "Can be downloaded flag : " + object.items[0].canDownload
def links = object.links
println "Services details :"
links.each{
println "Service : " + it.rel
println "URL : " + it.href
println "Action : " + it.action + "\n"
}
} else {
println "Error occurred while fetching application snapshot details"
if (object.details != null)
println "Error details: " + object.details
}