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.

Required Roles

Service Administrator

Any predefined role and the Migrations – Administer granular role

REST Resource

POST /interop/rest/{api_version}/applicationsnapshots

Supported Media Types: application/octet-stream

Table 9-49 Parameters

Name Description Type Default
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-50 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"
	}]
}

Example Request 1: Initialise Step

curl -s -u <USERNAME>:<PASSWORD> -H 'Content-Type: application/octet-stream' --request POST 'https://<BASE-URL>/interop/rest/v1/applicationsnapshots/<SNAPSHOT-NAME>.zip/contents?q=%7B%22isFirst%22%3Atrue%2C%22chunkSize%22%3A14%2C%22fileSize%22%3A%22<FILE-SIZE>%22%2C%22isLast%22%3Afalse%7D'

Parameters

{
  "isFirst": true,
  "chunkSize": 14,
  "fileSize": "<FILE-SIZE>",
  "isLast": false
}

Response

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

Example Request 2: Upload the Content

curl -s -u <USERNAME>:<PASSWORD> -H 'Content-Type: application/octet-stream' --request POST 'https://<BASE-URL>/interop/rest/v1/applicationsnapshots/<SNAPSHOT-NAME>.zip/contents?q=%7B%22startRange%22%3A%22<START-RANGE>%22%2C%22isFirst%22%3Afalse%2C%22chunkSize%22%3A<CHUNK-SIZE>%2C%22isLast%22%3Afalse%2C%22fileSize%22%3A%<FILE-SIZE>%22%2C%22endRange%22%3A%22<END-RANGE>%22%2C%22chunkNo%22%3A<CHUNK-NO>%7D' --data-binary @/u03/lcm/temp.DNpfOC/chunk_aa

Parameters

{
  "startRange": "<START-RANGE>",
  "isFirst": false,
  "chunkSize": <CHUNK-SIZE>,
  "isLast": false,
  "fileSize": "<FILE-SIZE>",
  "endRange": "<END-RANGE>",
  "chunkNo": <CHUNK-NUMBER>
}

Response

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

Example Request 3: Extract the Content

curl -s -u <USERNAME>:<PASSWORD> -H 'Content-Type: application/octet-stream' --request POST 'http://phoenix229110.appsdev.fusionappsdphx1.oraclevcn.com:10219/interop/rest/v1/applicationsnapshots/<SNAPSHOT-NAME>.zip/contents?q=%7B%22isFirst%22%3Afalse%2C%22chunkSize%22%3A14%2C%22fileSize%22%3A%22<FILE-SIZE>%22%2C%22isLast%22%3Atrue%7D'

Parameters

{
  "isFirst": false,
  "chunkSize": 14,
  "fileSize": "<FILE-SIZE>",
  "isLast": true
}

Response

{
  "details": null,
  "status": -1,
  "links": [
    {
      "href": "http://<BASE-URL>/interop/rest/v1/applicationsnapshots/<SNAPSHOT-NAME>.zip/contents",
      "action": "POST",
      "rel": "self",
      "data": null
    },
    {
      "href": "http://<BASE-URL>/interop/rest/v1/services/jobs/<JOB-ID>",
      "action": "GET",
      "rel": "Job' 'Status",
      "data": null
    }
  ]
}