List of common AEM cURL commands

Description




Steps





REPLICATION ACTIONS:






Activate

curl -u admin:admin -X POST -F path=“/content/path/to/page?lang=en” -F cmd=“activate” http://localhost:4502/bin/replicate.json

Deactivate
        curl -u admin:admin -X POST -F path=“/content/path/to/page?lang=en” -F cmd=“deactivate” http://localhost:4502/bin/replicate.json

Tree Activation
        curl -u admin:admin -F cmd=activate -F ignoredeactivated=true -F onlymodified=true 
        -F path=/content/geometrixx http://localhost:4502/etc/replication/treeactivation.html






PAGES:






Lock page
        curl -u admin:admin -X POST -F cmd=“lockPage” -F path=“/content/path/to/page?lang=en” -F “charset”=“utf-8” http://localhost:4502/bin/wcmcommand

Unlock page
        curl -u admin:admin -X POST -F cmd=“unlockPage” -F path=“/content/path/to/page?lang=en” -F “charset”=“utf-8” http://localhost:4502/bin/wcmcommand

Copy page
        curl -u admin:admin -F cmd=copyPage -F destParentPath=/path/to/destination/parent -F srcPath=/path/to/source/locaiton http://localhost:4502/bin/wcmcommand






REPLICATION AGENT:






Create Replication Agents

curl -u admin:admin ‘http://localhost:4502/bin/wcmcommand’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ --data ‘cmd=createPage&charset=utf-8&parentPath=/etc/replication/agents.author&title=ReplicationAgentTest&label=&template=/libs/cq/replication/templates/agent’






BUNDLES:






Uninstall a bundle

curl -u admin:admin -daction=uninstall http://localhost:4502/system/console/bundles/“name of bundle”

Install a bundle
        curl -u admin:admin -F action=install -F bundlestartlevel=20 -F 
        bundlefile=@“name of jar.jar” http://localhost:4502/system/console/bundles

Build a bundle
        curl -u admin:admin -F bundleHome=/apps/centrica/bundles/name of bundle -F 
        descriptor=/apps/centrica/bundles/com.centrica.cq.wcm.core-bundle/name_of_bundle.bnd 
        http://localhost:4502/libs/crxde/build

Stop a bundle
        curl -u admin:admin http://localhost:4502/system/console/bundles/org.apache.sling.scripting.jsp 
        -F action=stop

Start a bundle
        curl -u admin:admin http://localhost:4502/system/console/bundles/org.apache.sling.scripting.jsp 
        -F action=start

Delete a bundle
         curl -u admin:admin -X DELETE http://localhost:4502/apps/localhost/install/com.localhost.core-6.2.26-SNAPSHOT.jar






PACKAGES:






Upload a new package

curl -u admin:admin -F package=@“name_of_package.zip” http://localhost:4502/crx/packmgr/service/.json/?cmd=upload

Install an existing package
        curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/export/name of package?cmd=install

Upload a package AND install
        curl -u admin:admin -F file=@“name of zip file” -F name=“name of package” 
        -F force=true -F install=true http://localhost:4502/crx/packmgr/service.jsp

Upload a package DO NOT install
        curl -u admin:admin -F file=@“name of zip file” -F name=“name of package” 
        -F force=true -F install=false http://localhost:4502/crx/packmgr/service.jsp

Rebuild an existing package in CQ
        curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/name_of_package.zip?cmd=build

Download (the package)
        curl -u admin:admin http://localhost:4502/etc/packages/export/name_of_package.zip name of local package file






USER ADMINISTRATION:






Add user to a group

curl -u admin:admin -FaddMembers=testing http://localhost:4502/home/groups/c/contributor.rw.html

Remove User from a Group
        curl -u admin:admin -FremoveMembers=testing http://localhost:4502/home/groups/c/contributor.rw.html






BACKUP






Set delay time (optional - default is 10)

curl -u admin:admin -X POST http://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/a/BackupDelay?value=0

curl -u admin:admin -X POST http://localhost:4502/system/console/jmx/com.adobe.granite%3Atype%3DRepository/op/startBackup/java.lang.String?target=mvtest






UPLOAD ASSETS IN DAM






Upload an Asset(Ex: test.png)
curl -u admin:admin -X POST -F file=@“test.png” http://localhost:4502/content/dam/geometrixx/portraits.createasset.html






REINDEX






Reindex a Specific Index(Ex: damStatus)
curl -u admin:admin -F"reindex=true" http://localhost:4502/oak:index/damStatus

Resolution

On this page