AEM DAM Bulk Metadata Update using CURL
This article describes using CURL to update bulk metadata in AEM DAM. For this activity, I am updating the dam:assetState property value to: “processed”.
Steps:
- Get a list of DAM Asset path from AEM. The DAM Asset report can be generated based on your use-case. I am generating a report with the dam:assetState property.
- You can go to: http://localhost:4502/mnt/overlay/dam/gui/content/reports/reportlist.html and create a new report
- Select “Files” and give all the required info on the next screen and proceed further. Here you can click on Add under “Custom Columns” and give column name: Asset State and Property to map: jcr:content/dam:assetState and click on Create. This generates the CSV report.
4. Download the above CSV report
5. Since I want to filter the assets which has “processing” state and copy the paths to a text file (dam_assets.txt). Do not copy the headers of columns (first row). I was facing few issues with the CSV files so I ended up using plain text file.
Make sure you encode the spaces and other special characters.
6. Save below shell script to a file (dam_meta_prop_update.sh) where the dam_assets.txt file is located.
#!/bin/bashPROTOCOL=httpHOST=localhost:4502USER=adminPASS=adminNODE=/jcr:contentwhile read -r dam_path || [ -n “$dam_path” ]; doecho “DAM Asset Path is: $dam_path”curl — silent -k -u $USER:$PASS -Fdam:assetState=”processed” “$PROTOCOL://$HOST$dam_path$NODE” | grep -E ‘<title>|id=”Status”’ >> processed_urls.txtdone < dam_assets.txtecho “Successfully Processed DAM Assets!!”
7. Open terminal and execute the script: sh dam_meta_prop_update.sh
8. Above script saves the output to a processed_urls.txt file. This has a path and a response code. So you can analyze further if any errors.