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!
Solved! Go to Solution.
Views
Replies
Total Likes
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-... 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.
Hi,
You can enable the below config for duplicate asset detention
Once enabled, when uploading same asset, we will get error like below
Hello Ravi,
That did not fully answer my question. Does this duplicate detection functionality also support uploads through APIs?
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-... 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.