Download Application Snapshot (v2)

The Download Application Snapshot (v2) REST API downloads the application snapshot from EPM repository to the local location from where client is being run.

Required Roles

Service Administrator

Any predefined role and the Migrations – Administer granular role

REST Resource

POST /interop/rest/v2/files/download

Table 9-56 Tasks for Download Application Snapshot

Task Request REST Resource
Initiate download POST /interop/rest/v2/files/download
Status of compression of file GET /interop/rest/v2/status/download/<JOB-ID>
Download link GET /interop/rest/v2/files/download/<JOB-ID>
Deletion of temporary file (Applicable to snapshots) DELETE /interop/rest/v2/files/download/<JOB-ID>

Request

Supported Media Types: application/json

Table 9-57 Parameters

Name Description Type Required Default
fileName

Application snapshot name or to download (for example, "Artifact Snapshot").

Payload Yes None

Response

Supported Media Types: application/json

Response Header

fileExtension:This will have the file extension that can be used to create a file locally. Can contain values such as zip or csv.

Table 9-58 Parameters

Attribute Description
details

In 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 Possible value: self
data Parameters as key value pairs passed in the request

Example of Downloading with Postman

To download a file named <SNAPSHOT-NAME>.zip, select Basic Authorization header for all the requests.

Example URL and Payload to Initiate Download

Request Method: POST

Supported Media Types: application/json

https://<BASE URL>/interop/rest/v2/files/download
{
    "fileName": "<SNAPSHOT-NAME>.zip"
}
Example Response 1
{
    "details": null,
    "status": -1,
    "links": [
        {
            "href": " https://<BASE-URL>/interop/rest/v2/files/download",
            "action": "POST",
            "rel": "self",
            "data": null
        },
        {
            "href": " https://<BASE-URL>/interop/rest/v2/status/download/<JOB-ID>",
            "action": "GET",
            "rel": "Job Status",
            "data": null
        }
    ]
}

Sample cURL command

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' -d
'{"fileName":"<SNAPSHOT-NAME>.zip"}' 'https:///interop/rest/v2/files/download'

Example URL for Status of Compression File

Request Method: GET

Supported Media Types: application/json

https://<BASE-URL>/interop/rest/v2/status/download/<JOB-ID>

Example Response 2

{
    "details": null,
    "status": 0,
    "items": null,
    "links": [
        {
            "href": " https://<BASE URL>/v2/status/download/<JOB-ID>",
            "action": "GET",
            "rel": "self",
            "data": null
        },
        {
            "href": "https://<BASE URL>/v2/files/download/<JOB-ID>",
            "action": "GET",
            "rel": "Download link",
            "data": null
        }
    ]
}

Sample cURL command

curl -X GET -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json'
'https://<BASE URL>/interop/rest/v2/status/download/<JOB-ID>'

Example URL and Payload for Download Link

Request method: POST

Supported Media Types: application/json

https://<BASE-URL>/interop/rest/v2/files/download/<JOB-ID>

Example Response 3

After receiving the response, if the content type is application/json, then there would be an error on the server and refer to details. Otherwise, if it’s application/octet-stream, then the content to be downloaded is part of the response and can read from the response body.

Sample cURL command

curl -X GET -s -u '<USERNAME>:<PASSWORD>' -o <SNAPSHOT-NAME>.zip -D respHeader.txt -H 'Content-Type: application/json' 
'https://<BASE-URL>/interop/rest/v2/files/download/<JOB-ID>'

Example URL and Payload for Deletion of Temporary File

Request method: DELETE

Supported Media Types: application/json

https://<BASE URL>/interop/rest/v2/files/download/<JOB-ID>

Example Response 4

{
    "details": null,
    "status": 0,
    "links": [
        {
            "href": " https://<BASE-URL>/interop/rest/v2/files/download/<JOB-ID>",
            "action": "DELETE",
            "rel": "self",
            "data": null
        }
    ]
}

Sample cURL command

curl -X DELETE -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' 
'https://<BASE-URL>/interop/rest/v2/files/download/<JOB-ID>'