The Product Download Object
Products may have public, user-only or purchase-only downloads.
Properties
createdBy
read-only
An integer representing the Contact ID who created the Download item. This may be set to null if the object was created by an App or via import.
|
createdOn
read-only
The date and time the product download was created. |
description
An optional short description describing the download. |
file
The URL to a download in the Media Library may be a file up to 250MB in size.
Evance requires downloads to be imported into the Media Library. If you supply the download as a Data URI, or an external URL, Evance will import the file into the Media Library and an Evance CDN URL will be returned. See Importing Files below. |
id
read-only
An unsigned 64-bit integer, which is unique across all Product Downloads and all Evance Accounts. |
modifiedBy
read-only
An integer representing the Contact ID who last modified the download. This may be set to null if the download was created by an App or via import.
|
modifiedOn
read-only
The date and time the download was last modified. |
productId
read-only
An unsigned 64-bit integer representing the Product the Media item is associated with. |
sequence
Indicates the display position of the product download. The sequence of downloads starts from 1 (the first download). You may supply the sequence when adding or updating media items as an integer or as an object containing placement and
id properties (see Sequencing Downloads below).
If omitted when inserting a download, the new download will be positioned last in the sequence. |
title
An optional title up to 80 characters long. |
visibility
The visibility affects the availability and display of the item. The visibility may be one of the following:
|
Importing Files
Importing new downloads may be done using one of the following methods:
-
Content URI
Upload files to the Media Library manually through the Evance admin panel, then reference their location using a Content URI. For example, uploading a file namedmy-image-name.jpg
to theimages/products
subfolder in the Media Library is referenced as~/content/images/products/my-image-name.jpg
. Whilst this may be appropriate when importing Products via CSV, it may not be desirable for API integrations. -
External URLs
Evance will import file data from external URLs (http or https) into the Media Library. The file will be placed in an directory in the Media Library, which is calculated based on the URL and the mime type of the file. -
Data URIs
You can provide base64 encoded binary file data as a Data URI. Evance will calculate the directory within the Media Library based on the mime type of the file and the filename will be based on an md5 of the file contents.
When importing External URLs or Data URIs, you may want greater control over the resulting filename and location within the
Media Library. Supply your data within an object consisting of
src
,
filename
and
directory
properties:
src
Required. May be either an absolute External URL, or a Data URI. |
filename
Optional, allows you to set a preferred filename and extension for the media item. For example my-file-name.png. The file name should not include spaces or special characters. The extension must be appropriate to the mime type. |
directory
Optional, allows you to set a preferred directory within the Media Library and must be a valid Content URI starting with ~/content . |
Example
The example below highlights how to specify both a filename and directory for a media image imported using a Data URI.
{
"data": {
"file": {
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...",
"filename": "my-image-name.png",
"directory": "˜/content/images/products"
}
}
}
If the filename already exists within the directory supplied, the import may be ignored as Evance may assume the file already
exists.
Sequencing Downloads
The position of downloads is represented by the sequence
property. When importing
data you may adjust the sequence of downloads by supplying either an integer (starting from 1) or a position object containing
placement
and id
properties.
When supplying an integer, existing download with a sequence greater than or equal to the sequence supplied will increment by one. If you supply a sequence number greater than the current number of downloads, your media file will be positioned last and the appropriate sequence number will be recalculated and returned as part of the response.
Alternatively, you may supply a position object consisting of the following properties:
placement
May be one of the following:
|
id
Required when placement is either before or
after . Represents the ID of another Download for the same Product. |
Example
The example below shows a request to position the download before another download with ID 1234.
{
"data": {
"sequence": {
"placement": "before",
"id": 1234
}
}
}