Skip to content

Instantly share code, notes, and snippets.

@davidjgonzalez
Last active September 25, 2018 03:48
Show Gist options
  • Save davidjgonzalez/5468412 to your computer and use it in GitHub Desktop.
Save davidjgonzalez/5468412 to your computer and use it in GitHub Desktop.
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
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:4505/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:4505/crx/packmgr/service.jsp
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
bundlefile=@"name of jar.jar" http://localhost:4505/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:4505/libs/crxde/build
Stop a bundle
curl -u admin:admin http://localhost:4505/system/console/bundles/org.apache.sling.scripting.jsp
-Faction=stop
Start a bundle
curl -u admin:admin http://localhost:4505/system/console/bundles/org.apache.sling.scripting.jsp
-Faction=start
Delete a node (hierarchy) - (this will delete any directory / node / site)
curl -X DELETE http://localhost:4505/path/to/node/jcr:content/nodeName -u admin:admin
Rebuild an existing package in CQ
curl -u admin:admin -X POST http://localhost:4505:/crx/packmgr/service/.json/etc/packages/name_of_package.zip?cmd=build
Download (the package)
curl -u admin:admin http://localhost:4505/etc/packages/export/name_of_package.zip > name of local package file
Upload
curl -u admin:admin -F package=@"name_of_package.zip" http://localhost:4505/crx/packmgr/service/.json/?cmd=upload
Install
curl -u admin:admin -X POST http://localhost:4505/crx/packmgr/service/.json/etc/packages/export/name of package?cmd=install
Replicate
curl -u admin:admin -X POST http://localhost:4505/crx/packmgr/service/.json/etc/packages/export/name of package?cmd=replicate
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
= Dispatcher
Delete
curl -X POST --header "CQ-Action: Delete" --header "CQ-Handle:/content" --header "CQ-Page:/content" http://httpd.local:80/dispatcher/invalidate.cache
Further Resources - http://cq-ops.tumblr.com/post/19017053665/useful-curl-commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment