LCM Export

Initiates a repeat export of a Migration artifact based on the settings that were used to export artifacts using the Migration artifact export screen. This REST API is version 11.1.2.3.600.

You can also use the EPM Automate Utility to automate the repeat export of Migration artifacts.

The presence of status -1 in the response indicates that the reexport is in progress. You should use the job status URI to determine whether the reexport is complete.

If the Job completes with status 1, the task details will be mentioned in the items from which the source, destination, and URL to fetch the first set of errors is available. All issues for a particular task can be fetched in the manner of pagination. Acceptable values for msgtype are: error/warn/info; limit represents the number of issues requested per request, and offset marks the beginning number to fetch the issues.

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.

Table 6-34 LCM Export

Task Request REST Resource
LCM Export POST /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName}/migration?q={type:"export"}
Export Status GET /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName}/migration/8
Details GET /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName}/migration/8/0/details?limit=25&msgtype=error&offset=0

REST Resource

POST /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName}/migration?q={type:"export}

Parameters:

The following table summarizes the request parameters.

Table 6-35 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
applicationSnapshotName Application snapshot that has to be exported Path Yes None
type Type of migration being performed, can be export or import Query Yes None

Response

Supported Media Types: application/json

Parameters:

Table 6-36 Parameters

Attribute Description
details In case of errors, details are published with the error string
status See Status Codes
links Detailed information about the link
href Links to API call
action The HTTP call type
rel Possible values. Can be self and/or Job Status. If set to Job Status, you can use the href to get the status of the re-export operation
data Parameters as key value pairs passed in the request
items Details about the resource
source From where the navigation is being performed
destination To where the navigation is being performed
name Name of the task, usually "Task Information"
links Details of the first URL to be requested to get the job details; rel is "Job Details"

Example of Response Body

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

Response 1 example when export is in progress:

{
   "status":-1,
   "links":[{
      "data":null,
      "action":"POST",
      "rel":"self",
   "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migrationq={type:”export"}"
      },{
      "data":null,
      "action":"POST",
      "rel":"Job Status",
   "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/8"
   }],
   "details":null
} 

Response 2 example when export completes with errors:

{"status":1, 
"items":[{
   "source":"/Nasdaq/HSS-Shared Services",
   "name":"Task Information",
   "destination":"Shared Services",
   "links":[{
      "data":null,
      "action":"GET",
      "rel":"Job Details",
      "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/1/0/details?limit=25&offset=0&msgtype=error"}]
   },
   {"source":"/Artifact Snapshot/HP-NASDAQ",
   "name":"Task Information",
   "destination":"",
   "links":[{
      "data":null,
      "action":"GET",
      "rel":"Job Details",
      "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/1/1/details?limit=25&offse=0&msgtype=error"}]
   }],
   "details":null,
   "links":[{
      "data":null,
      "action":"POST",
      "rel":"self",
      "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/1"}
]}

Response 3 example when information on each task is requested:

{"status":0,
"items":[{
     "msgType":"error",
     "artifact":"/Native Directory/Groups",
     "msgText":"EPMIE-00069: Failed to find user during group children import. User user0026 not found. Please ensure that a user exists in the system.",
          "msgCategory":"14000: Error reported.",
     "msgCategory":"14000: Error reported." 
     },{
     "msgType":"error",
     "artifact":"/Native Directory/Groups",
     "msgText":"EPMIE-00069: Failed to find user during group children import. User user0025 not found. Please ensure that a user exists in the system.",
     "msgCategory":"14000: Error reported." }
     ],
"details":null,
"links":[{
     "data":null,
     "action":"GET",
     "rel":"self",
     "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/1/0/details?limit=2&msgType=error&offset=25"},
     {"data":null,
     "action":"GET",
     "rel":"next",
     "href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/1/0/details?limit=2&offset=27&msgType=error"},
     {"data":null,
     "action":"GET",
     "rel":"prev",
     "href":https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/ss2/migration/1/0/details?limit=2&offset=23&msgType=error
     }]
          }

Export Data Sample Code

Example 6-31 Java Sample – LcmExport.java

Prerequisites: json.jar

Common functions: See Appendix A, Common Helper Functions for Java.

//
// BEGIN - Export an application snapshot
//
public void exportSnapshot(String applicationSnapshotName) throws Exception {	
	JSONObject params = new JSONObject();
	params.put("type","export");
	String urlString = String.format("%s/interop/rest/%s/applicationsnapshots/%s/migration?q=%s", serverUrl, apiVersion, URLEncoder.encode(applicationSnapshotName, "UTF-8"), params.toString());
	String response = executeRequest(urlString, "POST", null);
	System.out.println("Export started successfully");
	getMigrationJobStatus(fetchPingUrlFromResponse(response, "Job Status"), "POST");		
}
//
// END - Export an application snapshot
//

Example 6-32 cURL Sample – LcmExport.sh

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

Common Functions: See Common Helper Functions for cURL

funcExportSnapshot() {
	param=$(echo "{type:export}" | sed -f urlencode.sed)
	encodedFileName=$(echo $1 | sed -f urlencode.sed) 
url=$SERVER_URL/interop/rest/$API_VERSION/applicationsnapshots/$encodedFileName/migration?q=$param
	funcExecuteRequest "POST" $url

	output=`cat response.txt`
	status=`echo $output | jq '.status'`
    if [ $status == -1 ]; then
        echo "Started exporting successfully"
		funcGetMigrationStatus "POST"
    else
        error=`echo $output | jq '.details'`
        echo "Error occurred. " $error
    fi
	funcRemoveTempFiles "respHeader.txt" "response.txt"
}

Example 6-33 Groovy Sample – LcmExport.groovy

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Groovy

def exportSnapshot(applicationSnapshotName) {
	def url;
	try {
		String snapshotName = URLEncoder.encode(applicationSnapshotName, "UTF-8");
		JSONObject params = new JSONObject();
		params.put("type","export");
		url = new URL(serverUrl + "/interop/rest/" + apiVersion + "/applicationsnapshots/" + snapshotName + "/migration?q=" + params.toString());
	} catch (MalformedURLException e) {
			println "Malformed URL. Please pass valid URL"
			System.exit(0);
	}
	response = executeRequest(url, "POST", null, "application/x-www-form-urlencoded");
	if (response != null) {
		getMigrationJobStatus(fetchPingUrlFromResponse(response, "Job Status"), "POST");
	}
}