Upload Application Snapshot

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 be uploaded. The client needs to break the existing stream into number of chunks depending on the logic that each chunk size is not greater than 50 * 1024 * 1024 bytes.

This API is version v1.

REST Resource

POST /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName}/contents?q={"isLast":false,"isFirst": true,"chunkSize":14,"fileSize":55445}

Supported Media Types: application/json

Parameters:

The following table summarizes the client request.

Table 6-26 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/octet-stream

Parameters:

Table 6-27 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

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

{
	"status":0,
	"details":null,
	"links":[{
		"data":null,
		"action":"POST",
		"href":"https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/v1/applicationsnapshots/ss2.zip/contents?q={"isLast":false,"isFirst":true,"chunkSize":14,"fileSize":55445},
		"rel":"self"
	}]
}

Example 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 (To create the file)

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

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

Example:

https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/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

Example Response 1

{
	"links": [
		{
			"rel": "self",{
			"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/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 (To upload the content)

URL https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=

Parameters {"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.)

Example:

https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=%7B%22startRange%22%3A%220%22%2C%22isFirst%22%3Afalse%2C%22chunkSize%22%3A12606%2C%22isL

To select the file: Select tab Body, radio button Binary, ChooseFile, Send

Example Response 2

{
	"links": [
		{
			"rel": "self",{
			"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/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
}

Example Request 3 (To extract the content out of the zip file)

URL https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/v1/applicationsnapshots/snapshot.zip/contents?q=

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

Example:

https://<https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/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

To select the file: Select tab Body, radio button Binary, ChooseFile, Send

Example Response 3

{
	"links": [
		{
			"rel": "self",{
			"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/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
}

Upload Application Snapshot Sample Code

For the following code samples, see Upload:

  • Java Sample — See uploadFile.java

  • cURL Sample — See UploadFile.sh

  • Groovy Sample — See UploadFile.groovy