Download Application Snapshot (v2)

This REST API supports downloading files with ASCII and non-ASCII filenames. Clients that support the filename* parameter of the Content-Disposition response header can preserve the original filename, including non-ASCII characters, spaces, and supported special characters.

REST Resource

POST /interop/rest/v2/files/download

Table 2-144 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 2-145 Parameters

Name Description Type Required Default
fileName

Name of the application snapshot or file to download (for example, "Artifact Snapshot").

Payload Yes None

Response

Supported Media Types: application/json or application/octet-stream

Download initiation, compression status, and temporary-file deletion return JSON responses. Successful file-content downloads return application/octet-stream. Errors during file-content downloads return 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.

Content-Disposition: Successful file-content download responses include the attachment disposition and a filename* parameter containing the UTF-8 percent-encoded filename. Supporting clients can decode this parameter to obtain the original filename. JSON error responses do not include the Content-Disposition attachment header.

Table 2-146 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://<BASE-URL>/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

If the response content type is application/json , an error occurred; refer to the details attribute for information. JSON error responses do not include the Content-Disposition attachment header. If the response content type is application/octet-stream , the response body contains the file content, and the Content-Disposition header provides the filename through its UTF-8 percent-encoded filename* parameter.

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>'