How resolve assets with the ClientLibrary?

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ x] Documentation issue or request

Current behavior

I’ve spent the day trying to understand how to piece things together using the ClientLibrary (v15) and got a basic blog working. I’m now trying to expand my POC to include a schema that uses assets.

I took a guess and set the Assets as an array of strings and I got back the file Ids, but how do I resolve the URL of the asset?

The lack of documentation and up-to-date samples is a huge problem.

Expected behavior

Minimal reproduction of the problem

Environment

App Name: dev-blog

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [x] Cloud version

Version: Whatever is deployed…no idea

Browser:

  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:

Hi,

It depends what you want to do with the file.

If you just want to get the URL to render it in a html template, you can use the following method:

If you want to something else, e.g. get metadata, you can use use the methods on the IAssetsClient, e.g.

const asset = await client.Assets.GetAssetAsync(myContent.assets[0]);

I will work on that.

Perfect, thank you for the information! I’ve managed to get it working perfectly. Our blog and Showcase on https://www.avaloniaui.net is now powered by Squidex.

1 Like

Nice, I have not done any desktop development for years now but I am following what you are doing and it is very impressive :slight_smile: