Request : GET /papi/v1/file/download/[File id]/[Conversion id]

Downloads a file from an asset using a conversion.

Parameter Parameter Type Mandatory Description
File id Path yes File id is a file unique identifier.In order to get the file id use search request.
See examples : Search asset
Conversion id Path yes Conversion identifer.
  • If conversion id = original conversion id or preview files conversion id,then the file is immediately available to download.
  • If conversion id is other than original conversion id or preview files conversion id and the file with requested conversion is not available, then the file has to be generated by the system before download.
  • Available conversion id’s for the file can be found at Asset.MasterFile.Conversions or Asset.AttachedFiles.FileInfo.Conversions.
    More information about conversions
x-auth-token Header yes The authentication token must be provided as a x-auth-token header for every api download request.
More information about authentication token.

Example of the asset object with master file id and conversions:

...   
        "MasterFile": {
        "Id": "1065",
        "Filename": "image",
        "Extension": "png",
        "Created": 1597836932,
        "Size": 507224,
        "PreviewSupported": "Ready",
        "Previews": [
            "1",
            "3"
        ],
        "Conversions": [
            "1",
            "3",
            "6"
        ],
...

If the requested conversion is immediately available (like original, id=1) the HTTP response with status code 200 contains the file binary.
If the conversion has to be generated before downloading the HTTP response then one of the following status code (other than 200) is returned as shown is below table:

Response code Response details Description
200 Ok The file with requested conversion is available and the file binary is retruned in HTTP response.
202 Conversion started. The file with requested conversion is not available yet.The file conversion process has started.
In this senario the download request has to be repeated after decent delay(few seconds) until the conversion completed.
204 Conversion Waiting. / Conversion Processing. The file with requested conversion is not available yet.The file conversion is either in process or in the queue.
In this senario the download request has to be repeated after decent delay(few seconds) until the conversion completed.
500 Conversion failed. File conversion failed for the requested conversion.
403 File version /Conversion setting does not exist or is inaccessible. Either requested file id/conversion id is wrong or
the user don’t have permissions for the requested file.

cURL example

curl --location --request GET 'https://[EMMi instance]/papi/v1/file/download/[File id]/[Conversion id]' \
--header 'x-auth-token: [Session token]'

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment