Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

here is the shell script example to upload assets in AEMaaCS

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/admin/develo... 

 

Deprecated asset upload APIs

The new upload method is supported only for Adobe Experience Manager as a Cloud Service. The APIs from Adobe Experience Manager 6.5 are deprecated. The methods related to upload or update assets or renditions (any binary upload) are deprecated in the following APIs:

  • Experience Manager Assets HTTP API
  • AssetManager Java API, like AssetManager.createAsset(..), AssetManager.createAssetForBinary(..), AssetManager.getAssetForBinary(..), AssetManager.removeAssetForBinary(..), AssetManager.createOrUpdateAsset(..), AssetManager.createOrReplaceAsset(..)


Arun Patidar

View solution in original post

10 Replies

Avatar

Community Advisor

Ji,

Please check Download assets

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



Arun Patidar

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



Arun Patidar

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.



Arun Patidar

Avatar

Level 2

@arunpatidar - The CQ Asset API is now deprecated in Cloud. So have to use Granite Asset API. In that case the  above issue will occur again. Is there a way to create an asset using Granite Asset API with the right metadata. As per the Adobe API DOC, there is not method of Asset as well to do this. Please confirm. 

Avatar

Level 2

@arunpatidar We have a code which uses CQ Asset API to create assets in the DAM programmatically. Is the asset upload the only programmatic solution available now or Granite Assets API can be used. I don't want to go via AEM developer console to upload the assets due to time constraints. 

 

FYI @ritik_r 

Avatar

Correct answer by
Community Advisor

here is the shell script example to upload assets in AEMaaCS

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/admin/develo... 

 

Deprecated asset upload APIs

The new upload method is supported only for Adobe Experience Manager as a Cloud Service. The APIs from Adobe Experience Manager 6.5 are deprecated. The methods related to upload or update assets or renditions (any binary upload) are deprecated in the following APIs:

  • Experience Manager Assets HTTP API
  • AssetManager Java API, like AssetManager.createAsset(..), AssetManager.createAssetForBinary(..), AssetManager.getAssetForBinary(..), AssetManager.removeAssetForBinary(..), AssetManager.createOrUpdateAsset(..), AssetManager.createOrReplaceAsset(..)


Arun Patidar

Avatar

Administrator

@jitendra_m Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni