Adobe CQ5 Curl Commands

Run JCR query builder API:

Find “all” page references for a given image/asset in a jcr path. The below command will return in JSON format:
curl -s -u ${username}:${password} -X GEThttp://localhost:4502/bin/querybuilder.json?path=/content/my-site&1_property=fileReference&1_property.value=/content/dam/my-site/image.jpg&p.limit=-1
*Note: -1 in the p.limit will return all page references else prints only 10.

Nike Air Force One Metallic Gold, Nike Air Foamposite One Metallic Gold Black, Nike Air Force One Crib - Boys' Infant Black/metallic Gold http://cialisgeneric20mgbest.com/627-nike-air-force-one-metallic-gold-nike-air-foamposite-one-metallic-gold-black-nike-air-force-one-crib-boys-infant-black-metallic.html
Air Jordan 11 Concord Fake, where Can I Buy Air Jordan 11 Concord, av7007-001 Wears Concord Theme All Year Round Air Jordan Futur http://jordanshoescheap4sale.com/701-Air-Jordan-11-Concord-Fake-Where-Can-I-Buy-Air-Jordan-11-Concord-AV7007-001-Wears-Concord-Theme-all-year-round-Air-Jordan-Futur.html

You can also specify the required number of page references; something like below which will return only 20 page references:
curl -s -u ${username}:${password} -X GEThttp://localhost:4502/bin/querybuilder.json?path=/content/my-site&1_property=fileReference&1_property.value=/content/dam/my-site/image.jpg&p.limit=20

To find all pending Jobs
curl -s -u admin:admin “http://localhost:4502/bin/querybuilder.json?&path=/var/eventing/jobs&type=slingevent:Job&p.limit=-1&fulltext=/com/day/cq/replication/job&fulltext.relPath=@slingevent:topic&property.and=true&property=slingevent:finished&property.operation=not&orderby=slingevent:created&orderby.sort=asc”

To find all Blocking Jobs
curl -s -u admin:admin “http://localhost:4502/bin/querybuilder.json?path=/var/eventing/jobs/anon&type=slingevent:Job&rangeproperty.property=event.job.retrycount&rangeproperty.lowerBound=1″

CQ Package Manager Commands:
Uninstall a bundle (use http://localhost:4502/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstallhttp://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: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 POSThttp://localhost:4502:/crx/packmgr/service/.json/etc/packages/name_of_package.zip?cmd=build

Download a package:
curl -u admin:adminhttp://localhost:4502/etc/packages/export/name_of_package.zip > name of local package file
Upload a package
curl -u admin:admin -F package=@”name_of_package.zip”http://localhost:4502/crx/packmgr/service/.json/?cmd=upload
Install a package
curl -u admin:admin -X POSThttp://localhost:4502/crx/packmgr/service/.json/etc/packages/export/name of package?cmd=install
CQ Bundle Manager Commands:
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/ projects-A/bundles/name of bundle -F descriptor=/apps/projects-A/bundles/com.centrica.cq.wcm.core-bundle/name_of_bundle.bnd http://localhost:4502/libs/crxde/build
Stop a bundle
curl -u admin:adminhttp://localhost:4502/system/console/bundles/org.apache.sling.scripting.jsp -Faction=stop
Start a bundle
curl -u admin:adminhttp://localhost:4502/system/console/bundles/org.apache.sling.scripting.jsp -Faction=start
JCR Node Management:
Delete a node (hierarchy) – (this will delete any directory / node / site)
curl -X DELETE http://localhost:4502/path/to/node/jcr:content/nodeName -u admin:admin

Create or add a JCR node:
curl -u admin:admin -F”_charset_=utf-8″ -F”:nameHint=node” -F”jcr:primaryType=nt:unstructured” -F”sling:resourceType=project-A/components/abc-definition” -F”nodeReferenceName=ref-name1″ -F”jcr:createdBy=bala” -F”jcr:lastModifiedBy=bala”http://localhost:4502/content/geometrixx/en_GB/products/jcr:content/abc/

Create or add a JCR node along with some properties:
curl -u admin:admin -F”_charset_=utf-8″ -F”:nameHint=var” -F”jcr:primaryType=nt:unstructured” -F”key=key1″ -F”value=key1-value”http://localhost:4502/content/geometrixx/en_GB/products/jcr:content/abc/variables/

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

User & Group Administration
Get User Info:
curl -u admin:admin http://localhost:4502/libs/granite/security/balakondepudi.json

Create User:
curl -u admin:admin -FcreateUser= -FauthorizableId=testuser -Frep:password=abc123http://localhost:4502/libs/granite/security/post/authorizables

Create Group:
curl -u admin:admin -FcreateGroup=group1 -FauthorizableId=testGroup1http://localhost:4502/libs/granite/security/post/authorizables

Create user with Profile:
curl -u admin:admin -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abc123 -Fprofile/gender=malehttp://localhost:4502/libs/granite/security/post/authorizables

Set a Profile Property on an Existing User:
curl -u admin:admin -Fprofile/age=29http://localhost:4502/home/users/t/testuser1.rw.html

Create a User as a Member of a Group:
curl -u admin:admin -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abc123 -Fmembership=contributorhttp://localhost:4502/libs/granite/security/post/authorizables

Add a User to a Group:
curl -u admin:admin -FaddMembers=testuser1http://localhost:4502/home/groups/t/testGroup.rw.html

Remove a User from a Group:
curl -u admin:admin -FremoveMembers=testuser1http://localhost:4502/home/groups/t/testGroup.rw.html

Set a User’s Group Memberships:
curl -u admin:admin -Fmembership=contributor -Fmembership=testgrouphttp://localhost:4502/home/users/t/testuser.rw.html

Delete user and Group:
curl -u admin:admin -FdeleteAuthorizable=http://localhost:4502/home/users/t/testuser
curl -u admin:admin -FdeleteAuthorizable=http://localhost:4502/home/groups/t/testGroup

Change an user password:
curl -u testuser:OLD_PWD -F rep:password=”NEW_PWD”http://localhost:4502/home/users/t/testuser.rw.html
curl rep:password=”test” –user admin:adminhttp://localhost:4502/home/users/a/alister@geometrixx.com

Backup Commands:
Online Backup:
curl -u admin:admin -X POSThttp://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/op/startBackup/java.lang.String?target=<PATH-TO-BACKUP>/12-feb-2013.zip

Online backup with delay in milli seconds:
curl -u admin:admin -X POSThttp://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/a/BackupDelay?value=<TIME-IN-MILISECOND&gt;
curl -u admin:admin –data “delay=TIME-IN-MILISECONDS&force=false&target=01-dec-2012.zip” http://localhost:4502/libs/granite/backup/content/admin/backups/

How to stop a running online backup:
curl -u admin:adminhttp://localhost:4502/libs/granite/backup/content/admin/backups.cancel.html

Link to track online progress:
http://localhost:4502/libs/granite/backup/content/admin.html

Datastore GC:
For Datastore Garbage Collection:
curl -u admin:admin -X POSThttp://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/op/runDataStoreGarbageCollection/java.lang.Boolean

Tar Optimization:
curl -u admin:admin -X POSThttp://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/op/startTarOptimization/

Flush Dispatcher Cache:
curl -H “CQ-Action: Flush” -H “CQ-Handle: /content/geometrixx/en/products” -H “CQ-Path:/content/geometrixx/en/products” -H “Content-Length: 0″ -H “Content-Type: application/octet-stream” http://dispatcher-server-hostname:port/dispatcher/invalidate.cache

Comments

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"

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 
        -F action=stop

Start a bundle
        curl -u admin:admin http://localhost:4505/system/console/bundles/org.apache.sling.scripting.jsp 
        -F action=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

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

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 a new package
        curl -u admin:admin -F package=@"name_of_package.zip" http://localhost:4505/crx/packmgr/service/.json/?cmd=upload

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

Activate
        curl -u admin:admin -X POST -F path="/content/path/to/page" -F cmd="activate" http://localhost:4502/bin/replicate.json

Deactivate
        curl -u admin:admin -X POST -F path="/content/path/to/page" -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

Lock page
        curl -u admin:admin -X POST -F cmd="lockPage" -F path="/content/path/to/page" -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" -F "_charset_"="utf-8" http://localhost:4502/bin/wcmcommand

Copy page
        curl -u admin:admin -F:operation=copy -F:dest=/path/to/destination http://localhost:4505/path/to/source

Further Resources:

http://cq-ops.tumblr.com/post/19017053665/useful-curl-commands
http://balawcm.wordpress.com/2013/02/13/curl-it-out-adobe-cq5-curl-commands-and-usage/

Who's new

  • s10
  • CIIUifBwwC

Who's online

There are currently 0 users online.