@All ,
We have a requirement where we need to find all the referenced assets from published/live pages on our PROD server. we have any analytics available on this or any script or code that can fetch this information
Solved! Go to Solution.
Views
Replies
Total Likes
AEM have internal service (AssetReferenceSearch) to get reference images.
AssetReferenceSearch search = new AssetReferenceSearch(
jcrNode, DAM_ROOT, request.getResourceResolver());
Map<String,Asset> result = search.search();
for (String key: result.keySet()) {
Asset asset = result.get(key);
// asset properties
Sring path = asset.getPath();
String mimeType = asset.getMimeType();
...
}
AEM have internal service (AssetReferenceSearch) to get reference images.
AssetReferenceSearch search = new AssetReferenceSearch(
jcrNode, DAM_ROOT, request.getResourceResolver());
Map<String,Asset> result = search.search();
for (String key: result.keySet()) {
Asset asset = result.get(key);
// asset properties
Sring path = asset.getPath();
String mimeType = asset.getMimeType();
...
}
There are multiple ways to achieve your requirement. One of the ways is through the referenced asset servlet also you can refer to the below link where it talks about custom java implementation and also on the query builder approach where you can further refine your filtering and get a targeted result.
Hi @nithinthomas ,
One of the way would be to use ACS commons MCP tool "Renovator". You can use same 'source' and 'Target' folder and 'select 'Dry Run' checkbox. you can download the excel report and can filter the report with 'references' column as zero.
https://adobe-consulting-services.github.io/acs-aem-commons/features/mcp-tools/renovator/index.html
Hope it helps!
Thanks,
Ritesh Mittal
Thanks @Ritesh_Mittal @sherinregi @Mahedi_Sabuj for the response. We want to do this activity on the PROD instance and we cannot do a deployment basically a java change as this point to time. Considering this what is the best next step to try in short time.
Hi @nithinthomas, You can find the assets reference using reference.json API
http://localhost:4502/libs/wcm/core/content/reference.json?path=contentPath
You need to manually filter type: "asset" to get reference assets only.
Hi @nithinthomas ,
Do you have the ACS AEM Commons MCP installed in PROD instance, if yes, then its report generation process.
@nithinthomas If you have groovy console enabled , then you can also try deriving groovy from the java snippets and try to get the asset list
You can filter search results based on the various options (predicates), such as, file type, file size, last modified date, status of asset, insights data, and Adobe Stock licensing. You can customize the Filters panel and add or remove search predicates using search facets.
@nithinthomas , Do you have Groovy console installed on your AEM instance?
If yes, you can create a simple groovy script and make use of the ReferenceAggregator API to find all asset references for a given content resource.
Hope this helps
Views
Like
Replies