How to retrieve the Asset Blob Source URL given an asset id?

Scenario: I’ve got a schema with an asset field. Assets are stored on Azure Blob Storage. I’ve configured a webhook that executes when a content item based on that schema is updated.
The webhook only contains the asset id:

"asset": {
  "iv": [

But I need the name of the Blob in Azure Blob Storage, as I need to update metadata there.

I’ve seen this topic, explaining I can use GraphQL. But I don’t think I can use GraphQL directly on assets? I can’t query on my content, as I need to cater for the scenario that the asset field is changed.
The “dataOld” contains the old asset id, so I need to query directly on asset id, I can’t query on my content type.

When I call the API at /api/apps/{app_name}/assets/{id} it returns a bunch of metadata, but not the sourceUrl.

The graphql endpoint should provide a sourceUrl field for each asset. You can resolve assets in graphql as well.

But if you have the id you can also determinate the blob source url. I am not sure how the asset blob storage urls are formatted, but the id is just the path to the asset.

Thanks @Sebastian for your prompt reply.
Just checked, the name of the blob seems to be {id}_0 , so _0 appended to the ID. Will try that, doing some more testing now.

that _0 at the end actually the version number. so when getting the asset name and URL you can also get the version and create the actual blob URL from that…

I use the azure storage as asset location and that storage is also mapped to a CDN site. So in some cases when I need the images to come from the CDN site directly I can construct the URL as follows:

const url_format = "https://myCDNsite/etc-squidex-assets/39f5cacb-bc68-4cc4-b4cd-4631fe4f2bcd";
const img = heroBackgroundImage[0].id;
const version = heroBackgroundImage[0].version;
const cdn = `${url_format}_${img}_${version}`;
1 Like