Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Create Asset method of Asset Manager is deprecated

Avatar

Level 2
Hello All,
 
I have created an asset in my servlet using Asset Manager's createAsset method but it was deprecated. I searched on community regarding this I found the solution on this https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-assets/correct-api-to-crea... .
In solution, he has suggested to use createOrReplaceAsset method but this method was also deprecated. I had gone through all the methods of Asset Manager, there are almost all the methods are deprecated.
Can anyone suggest me which method I have to use to create asset from backend using Asset Manager or else any different approach rather than Asset Manager.

Sample Code:
AssetManager assetManager = resolver.adaptTo(AssetManager.class);
File file = new File("/home/root322/Pictures/myPics");
InputStream targetStream = new FileInputStream(file);
assetManager.createAsset("/content/dam/aem-site/myPics", targetStream,null,true);
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

Please check this option, https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/admin/develo...  it seems this is the preferred way now to upload assets.

 

Hope this helps.



Esteban Bustamante

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

 

Please check this option, https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/admin/develo...  it seems this is the preferred way now to upload assets.

 

Hope this helps.



Esteban Bustamante