AEM Assets duplication detection through api upload | Community
Skip to main content
james-mke
Level 3
May 4, 2022
Solved

AEM Assets duplication detection through api upload

  • May 4, 2022
  • 1 reply
  • 2020 views

Is it possible to leverage the AEM Assets duplicate detection functionality when uploading assets through an API process?
I found this post that feels similar to the response that, yes it could be possible to build that into an API to initiate the check and provide the API to take action based on a response.

AEM Cloud Service - Assets server side check for D... - Adobe Experience League Community - 401019

Thank you!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anish-Sinha

Hi @james-mke ,

You are seeing the right documentation. There is no OOTB way to detect the duplicate images when you upload through the asset API. The configured OOTB functionality works when you upload it via browser UI or through AEM desktop. 

For Asset API, in this documentation http://experience-aem.blogspot.com/2021/03/aem-cloud-service-assets-server-side-check-for-duplicate-file-names.html you will have to write the filter which is this point 

3) Add a filter apps.experienceaem.assets.core.filters.DuplicateAssetNameCheck executing for .initiateUpload.json and .createasset.html requests to check for duplicate file names across the repo

This filter will be called every time the request happens to upload asset using the asset API. See the 

"sling.filter.pattern=((.*.initiateUpload.json)|(.*.createasset.html))",

this defines when this filter will be called. include this java class in your code and verify. You can modify the logic as per your requirement - to throw error or to upload and just log a message or something else.

1 reply

Ravi_Pampana
Community Advisor
Community Advisor
May 4, 2022

Hi,

 

You can enable the below config for duplicate asset detention

https://experienceleague.adobe.com/docs/experience-manager-64/assets/managing/duplicate-detection.html?lang=en

 

Once enabled, when uploading same asset, we will get error like below

 

james-mke
james-mkeAuthor
Level 3
May 5, 2022

Hello Ravi,

That did not fully answer my question. Does this duplicate detection functionality also support uploads through APIs?

 

Anish-Sinha
Adobe Employee
Anish-SinhaAdobe EmployeeAccepted solution
Adobe Employee
May 5, 2022

Hi @james-mke ,

You are seeing the right documentation. There is no OOTB way to detect the duplicate images when you upload through the asset API. The configured OOTB functionality works when you upload it via browser UI or through AEM desktop. 

For Asset API, in this documentation http://experience-aem.blogspot.com/2021/03/aem-cloud-service-assets-server-side-check-for-duplicate-file-names.html you will have to write the filter which is this point 

3) Add a filter apps.experienceaem.assets.core.filters.DuplicateAssetNameCheck executing for .initiateUpload.json and .createasset.html requests to check for duplicate file names across the repo

This filter will be called every time the request happens to upload asset using the asset API. See the 

"sling.filter.pattern=((.*.initiateUpload.json)|(.*.createasset.html))",

this defines when this filter will be called. include this java class in your code and verify. You can modify the logic as per your requirement - to throw error or to upload and just log a message or something else.