Info: This feature requires Elvis 5.6 or higher.
GET/POST http://yourserver.com/zip/<filename>.zip ?downloadKind=<original|preview> &assetIds=<comma-separated asset ids> |
What does it do?
Download originals or previews as a ZIP file.
This allows to package multiple files into a single .zip file. Depending on the browser this will be downloaded as .zip or folder on the local file system.
Parameters
assetIds |
List of asset ids for the ZIP file. Either 'q', 'assetIds' or 'folderPath' must be specified. Optional. |
q |
Select assets for the ZIP file using a query string instead of having to pass a long list of ids. Either 'q', 'assetIds' or 'folderPath' must be specified. Optional. |
folderPath |
Select assets in the folder path for the ZIP file. Either 'q', 'assetIds' or 'folderPath' must be specified. Optional. |
num |
Maximum number of assets to include in the produced ZIP file. Only used in combination with 'q'. When 'assetIds' is used instead, the number of assetIds is used as 'num'. Default value is 50. Optional. |
downloadKind |
The type of the files that are included in the archive. Possible values are:
Either 'downloadKind' or 'downloadPresetId' or 'previewFormat' must be specified. Optional. |
downloadPresetId |
Id of the download Preset to use. Assets specified in assetIds or matched by a query that do not support the Preset download format will not be included in the ZIP file. For example: an mp3 file cannot be downloaded in JPG format. Either 'downloadKind' or 'downloadPresetId' or 'previewFormat' must be specified. Optional. |
previewFormat |
Custom preview format specification for download. For description of the format, see Elvis 5 API - Previews . Assets specified in assetIds or matched by a query that do not support the format will not be included in the ZIP file. For example: an mp3 file cannot be downloaded in JPG format. Either 'downloadKind' or 'downloadPresetId' or 'previewFormat' must be specified. Optional. |
compress |
Customize the ZIP compression level (0-9).
Optional (when not specified, a default compression of 5 is used). |
stream |
Set to 'true' to write the stream of the ZIP file directly to the browser without creating a temporary file on the server. This will prevent the delay before the download starts, but will also prevent the browser from being able to provide proper download progress, since the total size of the ZIP file is not known before the download starts. Default value is 'true'. Optional. |
Allowed combinations and consistency check
The following are not allowed to send together:
- assetIds and/or q and/or folderPath
- downloadKind and/or downloadPresetId and/or previewFormat
The API checks that one and only one of parameters from those groups is specified.
Allowed combinations:
- /zip/archive.zip?assetIds=...&downloadKind=original
- /zip/archive.zip?assetIds=...&downloadKind=preview
- /zip/archive.zip?assetIds=...&downloadPresetId=...
- /zip/archive.zip?assetIds=...&previewFormat=<custom previewName>
- /zip/archive.zip?q=...&num=10&downloadKind=original or /zip/archive.zip?q=...&downloadKind=original
- /zip/archive.zip?q=...&downloadKind=preview (or with num)
- /zip/archive.zip?q=...&downloadPresetId=... (or with num)
- /zip/archive.zip?q=...&previewFormat=<custom previewName> (or with num)
- /zip/archive.zip?folderPath=...&num=10&downloadKind=original or /zip/archive.zip?folderPath=...&downloadKind=original
- /zip/archive.zip?folderPath=...&downloadKind=preview (or with num)
- /zip/archive.zip?folderPath=...&downloadPresetId=... (or with num)
- /zip/archive.zip?folderPath=...&previewFormat=<custom previewName> (or with num)
Errors
In the following situations, the API returns a HTTP status code together with additional information:
Error | Error details | Scenario |
---|---|---|
(Bad Request) 400 | Required String parameter 'downloadKind' is not present. | When incorrect parameters or a combination of incorrect parameters are specified. |
(Not Found) 404 | No assets found to include in ZIP. | When no assets are selected. |
(Bad Request) 400 | DownloadPreset with given ID is not found. | When downloadPresetId does not exists or is not accessible for the user. |
(Not Found) 404 | No previews can be included in ZIP. |
When no previews are available to be included in the ZIP file. |
Example
This call downloads an archive named wildlife.zip containing previews of assets with ids 'EgNUCWzhqBh8DxwRUtkzQ5,FpERTjYia2X81GoYQi7btF'.
zip http://demo.elvisdam.com/zip/wildlife.zip ?downloadKind=preview &assetIds=EgNUCWzhqBh8DxwRUtkzQ5,FpERTjYia2X81GoYQi7btF |
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.