Hi All,
I am integrating AEM with rest service which is providing image/asset urls . using this url ,I have to get image and this image should upload to AEM DAM System.
I am planning to download image in aem root/folder path using http client api. Then using AEM Assets http Api will upload to dam folder.
Is this approach fine ?
Could you please share best approach to implement this kind of scenario.
Appreciate your comments.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi
you can use Asset Java API as well to fetch as inputstream and create assets e.g. below code
public String importAsset(String assetUri, ResourceResolver resolver){ AssetObj assestObj = requestService.getAsset(assetUri); InputStream is = assestObj.getAssetAsInputStream(); String mimeType = assestObj.getMimeType(); String assetsPath = assestObj.getAssetDamPath(); AssetManager am = resolver.adaptTo(AssetManager.class); Asset asset = am.createAsset(assetsPath, is, mimeType, true); resolver.commit(); }
Duplicate of https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/download-upload-assets-to-...
Thanks,
Kiran Vedantam.
Hi
you can use Asset Java API as well to fetch as inputstream and create assets e.g. below code
public String importAsset(String assetUri, ResourceResolver resolver){ AssetObj assestObj = requestService.getAsset(assetUri); InputStream is = assestObj.getAssetAsInputStream(); String mimeType = assestObj.getMimeType(); String assetsPath = assestObj.getAssetDamPath(); AssetManager am = resolver.adaptTo(AssetManager.class); Asset asset = am.createAsset(assetsPath, is, mimeType, true); resolver.commit(); }
Thanks Arun for your input