Detailed Asset
An Asset represents a file within an Airkit Application and contains the information necessary to access that file. This means that there are certain properties an Asset is required to have (which includes properties such as the assetKey and id.
In addition to the required properties, an Asset can also include other properties that describe information such as the file type, size, and state of the Asset. These are not required in order to classify a Data Type as an "Asset", but they are required to classify a Data Type as a "Detailed Asset".
Properties of a Detailed Asset
A Detailed Asset is a subcategory of Asset that contains the following properties in addition to the properties contained by all Assets:
displayName (String) - the filename of the Asset like "textfile.txt" or "myimage.jpg".
description (String) - currently an unused property; will be NULL.
size (Number) - the size of the Asset in bytes. The maximum limit is 10 megabytes.
expiration (Number) - refers the to the number of milliseconds that the Asset still has before expiration. This value is updated each time the download link is fetched. Private Assets expire after a maximum of seven days. Global Assets do not expire; expiration
values associated Global Assets are not valid.
scope (String) - refers to the scope of the Asset. Can have a value of APP, in which case it is tied to the application and be accessed by any instance, or SESSION which means that Asset is tied to the user session. If an Asset contains personal info, it is probably best to ensure the scope is SESSION and if the Asset should be accessible to anyone through Media Library, it should be set to APP.
region (String) - specifies where the Asset should be available for public CDNs. This is only relevant to Public assets.
createdTime (String) - Timestamp indicating when the Asset was created.
modifiedTime (String) - Timestamp of the last modification of the Asset.
deletedTime (String) - If the Asset has been deleted, this is the is the timestamp of the deletion time. NULL otherwise.
validationErrors (String) - this message is text generated by Airkit to display errors with creation of Assets, for various reasons like size issues, viruses, and invalid kinds. NULL if no errors.
extraInfo (Any JSON Data Type) - used by some integrations to store information about the creation of an Asset. You can write to it to store extra information on your Asset. NULL otherwise.
downloadUrl (String) - a URL for downloading this Asset.
thumbnailUrl (String) - the URL for an Asset's thumbnail if it has one. NULL otherwise.
state (String) - to the state of the Data. Available options are "DRAFT", "PENDING", or "ACTIVE".
"DRAFT" means the Asset has been declared but hasn't been fully received yet.
"PENDING" is the state after the Asset has been fully received, but the server side processing is not yet finished.
"ACTIVE" is a fully queryable Asset.
type (String) - refers the MIME type of the Asset. It can be text, image, or any other valid type. Here is a table of supported data types:
Mime Type | Type of Data |
---|---|
image/jpeg | Jpeg Image |
image/png | PNG Image |
application/pdf | |
image/svg+xml | An SVG XML file |
image/gif | GIF image |
audio/mpeg | MPEG Audio data |
audio/mp3 | An MP3 file |
audio/wav | WAV audio file |
video/mp4 | MP4 Video file |
text/html | HTML file |
application/zip | Compressed Zip file |
application/pgp-encrypted | First part of PGP encrypted data, body |
application/vnd.ms-excel | Microsoft Excel file |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Excel (OpenXML) |
font/otf | OpenType font |
font/ttf | TrueType Font |
font/woff | Web Open Font Format (WOFF) |
font/woff2 | Web Open Font Format (WOFF) |
Accessing a Detailed Asset
A Detailed Asset is returned by the Fetch Asset Details Data Operation. The File Upload Control also interprets files uploaded by users as Detailed Assets, which is accessible within the Control as event.value.asset
.
When to use a Detailed Asset
Most obviously, Detailed Assets are useful when you need to access specific and detailed information pertaining to an Asset, such as its file type, size, or state. Additionally, there are some Airscript Functions, such as ASSET_TYPE and ASSET_STATE, that require input in the form of a Detailed Asset.
Example: Properly-formatted Detailed Asset:
Last updated