ASSET_TYPE

The function ASSET_TYPE takes a Detailed Asset and returns the mime type of the Asset.

This function takes a Detailed Asset as input. It returns a String containing the mime type of the Asset, such as “image/jpeg” or “text/plain”.)

Declaration

ASSET_TYPE(detailed_asset) -> type

 

Parameters

detailed_asset (required, type: Detailed Asset)
Any Detailed Asset.
Note that a Detailed Asset is a subcategory of an Asset, and that the ASSET_TYPE function will not accept a general Asset as input, only a Detailed Asset.

Return Values

type(type: string)

The MIME type of the Detailed Asset, which can be text, image, or any other valid type. Here is a table of supported data types:

Mime TypeType of Data
image/jpegJpeg Image
image/pngPNG Image
application/pdfPDF
image/svg+xmlAn SVG XML file
image/gifGIF image
audio/mpegMPEG Audio data
audio/mp3An MP3 file
audio/wavWAV audio file
video/mp4MP4 Video file
text/htmlHTML file
application/zipCompressed Zip file
application/pgp-encryptedFirst part of PGP encrypted data, body
application/vnd.ms-excelMicrosoft Excel file
application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMicrosoft Excel (OpenXML)
font/otfOpenType font
font/ttfTrueType Font
font/woffWeb Open Font Format (WOFF)
font/woff2Web Open Font Format (WOFF)

Examples

Assume the example has access to the following Detailed Asset, detailed_asset:

detailed_asset -> {  
 "id": "9d65de10-e1d5-4439-93c1-70434bec96a0",  
 "assetKey": "dc3ea11e-a294-40db-b47d-d3891d850710",  
 "organizationId": "15a00ea3-6980-48ea-8e8c-651ddff1f0bf",  
 "displayName": "placekitten.jpeg",  
 "description": null,  
 "type": "image/jpeg",  
 "size": 6483,  
 "version": 0,  
 "expiration": 600000,  
 "visibility": "GLOBAL",  
 "state": "ACTIVE",  
 "scope": "APP",  
 "region": "us-west-2",  
 "createdTime": "2021-12-15T00:44:50.459Z",  
 "modifiedTime": "2021-12-15T00:44:52.076Z",  
 "deletedTime": null,  
 "validationErrors": null,  
 "extraInfo": null,  
 "downloadUrl": "https://assets.airkit.com/15a00ea3-6980-48ea-8e8c-651ddff1f0bf/dc3ea11e-a294-40db-b47d-d3891d850710/9d65de10-e1d5-4439-93c1-70434bec96a0/0",  
 "thumbnailUrl": "https://assets.airkit.com/15a00ea3-6980-48ea-8e8c-651ddff1f0bf/dc3ea11e-a294-40db-b47d-d3891d850710/9d65de10-e1d5-4439-93c1-70434bec96a0/0_t"  
}

The following example takes the Detailed Asset defined above and returns its MIME type. Note that this matches the value of the type property given above:

ASSET_TYPE(detailed_asset) -> "image/jpeg"