Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

AEM Assets download issue for custom assets

Avatar

Level 2

Hi,

I am unable to download the custom assets from AEM assets console but I am able to download the same assets from damadmin.

Not sure if I am missing any configuration.

Thanks,

Jitendra

5 Replies

Avatar

Community Advisor

Ji,

Please check Download assets

Let us know what issue you are facing with screenshots, that would help.

Avatar

Level 2

Hi Arun,

We are uploading bulk assets into AEM from some other tool.

I have observed that I was using below asset manager api to create assets.

com.adobe.granite.asset.api.AssetManager

com.adobe.granite.asset.api.Asset asset = assetMgr.createAsset(absTargetPath);

But, the assets were uploaded with 0B size and that might be the reason why I was not able to download them in AEM asset console and also, they are not accessible directly on browser.

So, now I have used "com.day.cq.dam.api.AssetManager" api

com.day.cq.dam.api.Asset asset = assetMgr.createAsset(absTargetPath, is, mimeType, true);

Now, the assets are correctly uploaded with correct size and are now able to download as well.

I am not sure why granite Asset Manager api is not uploading assets properly but the reason I have used granite api is- I am doing the asset relation through code and I can only able to do that by using granite api, I am not sure if dam api has any option for creating asset relation.

AEM version : AEM 6.4

Thanks,

Jitendra

Avatar

Community Advisor

Hi,

The granite Api, doesn't have method to read assets from filesystem.

It has only one parameter which is repo path where Asset would be created.

It is missing InputStream param.

AssetManager assetManager = resolver.adaptTo(AssetManager.class);

  Asset newAsset = assetManager.createAsset("/path/to/asset/document.pdf");

For creating Asset, you can use com.day.cq.dam.api.AssetManager

Avatar

Level 2

Hi Arun,

Yes, the granite Api doesn't have method to read assets from fielsystem. So I have used com.day.cq.dam.api.AssetManager for creating assets.

Also, I have used granite api for asset relate/un-relate because com.day.cq.dam.api.AssetManager doesn't have method for asset relation.

Please let me know if this approach is fine, where we can use both api's (one for creating assets from filesystem and second for creating asset relation).

Currently, this solution is working fine for me.

Thanks,

Jitendra

Avatar

Community Advisor

Hi,

Yes, it's fine to use CQ API instead Granite API.

for example Granite Workflow API doesn't have method to get session from workflow session but CQ API has, so we do use API according to the requirement.