URI_TO_ASSET

The function URI_TO_ASSET takes an asset URI in the form of a string and returns the Asset.

This function takes as input a String representing a valid asset URI. It returns the Asset associated with the given asset URI. 

Declaration

URI_TO_ASSET(asset_uri) -> asset

 

Parameters

asset_uri (required, type: string)
A string containing a valid asset URI.

Return Values

asset (type: Asset)
The Asset that the given asset URI points to. If it cannot parse the URI, it throws an error.

Examples

Assume we know there is an asset associated with the asset URI "asset://global:15a00ea3-6980-48ea-8e8c-651ddff1f0bf:f1919287-7659-459e-a975-4d057762cc17:46dc543e-e960-4d38-8dd0-ec51dfdd19d1:0". The following example returns the Asset associated with the asset URI:

URI_TO_ASSET("asset://global:15a00ea3-6980-48ea-8e8c-651ddff1f0bf:f1919287-7659-459e-a975-4d057762cc17:46dc543e-e960-4d38-8dd0-ec51dfdd19d1:0") -> {  
 "organizationId": "15a00ea3-6980-48ea-8e8c-651ddff1f0bf",  
 "assetKey": "f1919287-7659-459e-a975-4d057762cc17",  
 "id": "46dc543e-e960-4d38-8dd0-ec51dfdd19d1",  
 "version": 0,  
 "visibility": "GLOBAL"  
}

The following example attempts to find the Asset that associated with the URI "This is a string". "This is a string" is not a valid URI, and so URI_TO_ASSET throws an error. 

URI_TO_ASSET("This is a string") -> ERROR

 

Discussion

For a deeper dive into the use cases of URI_TO_ASSET, check out The Fetch Asset Details Data Operation or Working with existing PDFs.