product_assets
The product_assets
API retrieves a list of all of all static files associated with a particular product. Any given product may have zero or more such assets.
Parameters
- api_key (string) Required - The API key for the account
- id (integer) Required - The unique identifier for the product. This may be retrieved from the
id
attribute of the individual product in the product_group API - last_updated_at (datetime) Optional - If this parameter is supplied, only assets whose last edited date is after the supplied date and time will be returned. The parameter should be formatted as "YYYY-MM-DD HH:MM:SS" and will be interpreted as a UTC date and time value.
Notes
The request must be formatted as https://dashboard.onpremisewine.com/products/\<id>/assets.json
.
This API is a superset of the beer_assets, spirit_assets, and wine_assets APIs. For those specific types, you can use either this API or the dedicated APIs (and will get the same results either way).
Response
The product_assets
API returns a JSON array of assets. Each member of the array includes these attributes:
- id - Unique identifier.
- type - The type of file. See below for valid types.
- subtype - The subtype of file. This will be a string such as "WineLabelAsset" that indicates the particular use of this asset on the user interface.
- display_position - 1 for the primary image, 2 for the secondary image, null for other images.
- versions - An array of versions. Each version has an identifier and a URL from which the file can be retrieved.
- asset_content_type - MIME type of the file.
- asset_file_size - Size in bytes of the file.
- updated_at - The date that this file was last edited.
- processed - If
true
then the file is ready to download. - status - File status. A value of
0
indicates an active file. A value of1
indicates a deleted file. - original_url - URL of the original uploaded file. You cannot assume anything about the size of this file.
- product_id - The unique identifier of the product to which this file belongs.
Asset file types
- ImageAsset - Image
- VideoAsset - Video file
- DocxAsset - Word Document
- PdfAsset - PDF
Sample Request
https://dashboard.onpremisewine.com/products/1001/assets.json?api_key=ABCDEF123456
Sample Response
{
"assets": [
{
"id": 1966,
"type": "ImageAsset",
"subtype": "WineLabelAsset",
"display_position": 1,
"versions": {
"ipad_one_up_thumb": {
"url": "http://c448288.r88.cf2.rackcdn.com/uploads/beer_label_asset/61966/ipad_one_up_thumb_1135210_image.jpg"
},
"web_thumb": {
"url": "http://c448288.r88.cf2.rackcdn.com/uploads/beer_label_asset/61966/web_thumb_1135210_image.jpg"
},
"ipad_list": {
"url": "http://c448288.r88.cf2.rackcdn.com/uploads/beer_label_asset/61966/ipad_list_1135210_image.jpg"
}
},
"asset_content_type": "image/jpeg",
"asset_file_size": 8785,
"updated_at": "2011-09-10T12:43:04-07:00",
"processed": true,
"status": 0,
"original_url": "http://c448288.r88.cf2.rackcdn.com/uploads/beer_label_asset/61966/1135210_image.jpg",
"product_id": 1001
}
]
}