The Product Media Object
Product may have a mixture of photos, videos and 360 degree media items.
Properties
createdBy
read-only
An integer representing the Contact ID who created the Media item. This may be set to null if the Product was created by an App or via import.
|
createdOn
read-only
The date and time the media item was created. |
description
An optional short description describing the media item up to 200 characters long. |
frames
An array containing URLs to images within the Media Library may be a JPEG ,
GIF , or PNG file up to 20MB in
size each.
Evance requires images to be imported into the Media Library. If you supply each image as a Data URI, or an external URL, Evance will import the image into the Media Library and an Evance CDN URL will be returned. The frames property is applicable to media items with a type of
rotate only.
See Importing Media Files below. |
id
read-only
An unsigned 64-bit integer, which is unique across all Product Media and all Evance Accounts. |
image
The URL to an image in the Media Library may be a JPEG , GIF ,
or PNG file up to 20MB in size.
Evance requires images to be imported into the Media Library. If you supply the image as a Data URI, or an external URL, Evance will import the image into the Media Library and an Evance CDN URL will be returned. The image property is required for all media types. See Importing Media Files below. |
isPrimary
Boolean, indicates whether the media item is used as the primary image for the Product. The primary media item is used as the Products thumbnail at Category level. A Product may only have one primary media item. |
modifiedBy
read-only
An integer representing the Contact ID who last modified the Media item. This may be set to null if the Product was created by an App or via import.
|
modifiedOn
read-only
The date and time the media item 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 media item. The sequence of media items starts from 1 (the first media item). 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 Media Items below).
If omitted when inserting media, the new media item will be positioned last in the sequence. |
title
An optional title up to 80 characters long for the media item may be displayed or used as an alt attribute.
|
type
Type affects the media requirements and display. The type may be one of the following:
|
video
The URL to a YouTube, Vimeo video or an MP4 file within the Media Library up
to 250MB in size.
If you supply the video as a Data URI, or an external URL (except YouTube or Vimeo URLs), Evance will import the video into the Media Library and an Evance CDN URL will be returned. A video URL is required if the type is set to
video and may be ignored or set to null for alternative
types of media.
See Importing Media Files below. |
Importing Media Files
Importing new files for
image
,
video
and
frames
properties 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
With the exception of YouTube and Vimeo URLs for video content, 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": {
"image": {
"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 Media Items
The position of media items is represented by the sequence
property. When importing
data you may adjust the sequence of media files by supplying either an integer (starting from 1) or a position object
containing placement
and id
properties.
When supplying an integer, existing media items 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 media items, 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 Media item for the same Product. |
Example
The example below shows a request to position the media item before another media item with ID 1234.
{
"data": {
"sequence": {
"placement": "before",
"id": 1234
}
}
}