Upload Application Snapshot (v1)

This API uploads an application snapshot to the Planning repository. The client needs to call upload API multiple times based on the size of file to upload. The client needs to break the existing stream into a number of chunks depending on the logic that each chunk size is not greater than 50 * 1024 * 1024 bytes.

This API is version v1.

Required Roles

Service Administrator

Power User assigned to the Migration Administrator Profitability and Cost Management application role

REST Resource

POST /interop/rest/{api_version}/applicationsnapshots

Supported Media Types: application/octet-stream

The following table summarizes the client request.

Table 9-51 Parameters

Name Description Type Default
api_version Specific API version Path N/A
applicationSnapshotName Name of the application snapshot to be uploaded. A file with this name is created in the Planning repository. If a file or folder with this name exists in the repository, an error is thrown indicating that a file or folder exists. Path N/A
isLast If the chunk being passed is the last one then set to true Query N/A
chunkSize Size of the chunk being passed in bytes Query N/A
isFirst If the chunk being passed is the first one and there will be subsequent requests for upload then set as true Query N/A
fileSize The size of the file being uploaded Query N/A

Response

Supported Media Types: application/json

Table 9-52 Parameters

Name Description
details In the 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 Is self, which denotes the URL of this REST API.
data Parameters as key value pairs passed in the request

Example of Response Body

{
	"status":0,
	"details":null,
	"links":[{
		"data":null,
		"action":"POST",
		"href":"https://<BASE URL>/interop/rest/v1/applicationsnapshots/ss2.zip/contents,
		"rel":"self"
	}]
}

Examples of Uploading with Postman

To upload a file named snapshot.zip of size 12606 bytes, select request method as POST and Basic Authorization header for all the requests.

Example Request 1: Create a File

Parameters

https://<BASE URL>//interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=PARAMETERS -> {"isFirst":true,"chunkSize":14,"fileSize":"12606","isLast":false} // utf-8 encoded value of it

{"isFirst":true,"chunkSize":14,"fileSize":"12606","isLast":false} // utf-8 encoded value of it

URL and Response

https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22isFirst%22%3Atrue%2C%22chunkSize%22%3A14%2C%22fileSize%22%3A%223318004%22%2C%22isLast%22%3Afalse%7D
{
	"links": [
		{
			"rel": "self",{
			"href": "https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22isFirst%22:true,%22chunkSize%22:14,%22fileSize%22:%223318004%22,%22isLast%22:false%7D",
			"data": null,
			"action": "POST"
		}
	],
	"details": null,
	"status": 0
}

Example Request 2: Upload the Content

Parameters

https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=

{"startRange":"0","isFirst":false,"chunkSize":12606,"isLast":false,"fileSize":"12606","endRange":"12605","chunkNo":1} // encoded value of it (Ensure the value of the parameters chunkSize and fileSize is equivalent to the total size of the file and endRange is set to fileSize - 1.)

URL and Response

https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22startRange%22%3A%220%22%2C%22isFirst%22%3Afalse%2C%22chunkSize%22%3A12606%2C%22isLast%3A%22false%22%7D
{
	"links": [
		{
			"rel": "self",{
			"href": "https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22startRange%22:%220%22,%22isFirst%22:false,%22chunkSize%22:12606,%22isLast%22:false,%22fileSize%22:%2212606%22,%22endRange%22:%2212605%22,%22chunkNo%22:1%7D",
			"data": null,
			"action": "POST"
		}
	],
	"details": null,
	"status": 0
}

To select the file, select tab Body, radio button Binary, and select File, Send.

Example Request 3: Extract the Content Out of the Zip File

Parameters

https://<<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=

{"isFirst":false,"chunkSize":14,"fileSize":"12606","isLast":true} // utf-8 encoded value of it

URL and Response

https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22isFirst%22%3Afalse%2C%22chunkSize%22%3A14%2C%22fileSize%22%3A%2212606%22%2C%22isLast%22%3Atrue%7D
{
	"links": [
		{
			"rel": "self",{
			"href": "https://<BASE URL>/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22isFirst%22:false,%22chunkSize%22:14,%22fileSize%22:%223318004%22,%22isLast%22:true%7D",
			"data": null,
			"action": "POST"
		}
	],
	"details": null,
	"status": 0
}

To select the file:, select tab Body, radio button Binary, select File, Send.