Asset
Asset
is a Data Type used to refer to a file asset. This file can be of any type: a text file, a zip file, or even an image. The Asset Data Type represents the file in your application. You can create Assets that are global to your application in Media Library. You can also create Assets through Data Flows in Connections Builder.
📘 The Asset Data Type refers to a file asset, but it doesn't necessarily contain all relevant information about the asset. A subcategory of Asset, the Detailed Asset, contains all of their properties and then some, including information about the Asset's file type, size, and state.
Structure
The Asset Data Type is an object with the following properties:
id (
string
) - the unique identifier of this Asset. It is a UUID string.assetKey (
string
) - used to distinguish which version of the Asset you want to use. It is the branch ID of where the Asset is stored.organizationId (
string
) - Assets are scoped to Organizations. This ID represents the Organization ID for which the Asset belongs to.version (
Number
) - indicates which version of the Asset being referred to when making updates to an Asset we will modify the version number.visibility (
string
) - can be either GLOBAL or PRIVATE. Global Assets are available on the CDN with a static link. Private visibility requires a generated link where you can set the retention policy.URLs linking to Private Assets have a retention policy that can be configured. They expire at most seven days from the creation of the Asset.
URLs linking to Global Assets do not expire.
Examples
Assets can be returned using Airscript expressions. For example, the URI_TO_ASSET function. Assume we know there is an Asset associated with the Asset URI "asset://global:8e52c37f-4071-4dbb-8a98-d9096d9b69d2:d527500a-502d-463b-8fe0-eddf7397fbe2:ead7b376-6560-415a-917a-0fb1cc58f3eb:0"
(a value we can pull by examining the Asset within the Media Library). The following example returns the Asset associated with the Asset URI:
Assets can also be used as input within Airscript expressions. For instance, the function ASSET_TO_URI takes an Asset and returns is URI. The previous example returned an Asset from a URI; the following example takes the Asset returned in the last example and returns the initial URI:
Properties of Assets can be accessed via dot notation. Say, for instance, that the Asset from the previous two examples is saved under the variable example_asset
. The value of its visibility property would be referenced as follows:
Last updated