Sunday, November 19, 2017

AEM - Use cURL to activate or deactivate paths, assets or content

1. Create a text file with all paths to be activated or deactivated:

Example of line from paths.txt file:

/content/dam/products/space/image.jpg


2. Run the following script to deactivate or activate the paths (replace cmd operation below as per own need) :

#!/bin/bash

count=0

while IFS='' read -r line || [[ -n "$line" ]]; do
    count=$((count+1))
    echo $count
    echo "Deactivating path: $line "
    curl -u user:"pass" -X POST -F path="$line" -F cmd="deactivate" http://AEM-instance-ip:port/bin/replicate.json
    sleep 1
done < "paths.txt"


Note: Please run the above script from within same private network where AEM is located. You do not want to send pass/user over the internet.

No comments:

Post a Comment