Skip to content

AEM cURL Commands

DISCLAIMER:

This is just a custom guide on http://skydevops.co.in, this could be more technical and advanced guide, if you do not understand or don’t know what you are doing, I kindly request you to take extreme caution. The components used on http://skydevops.co.in might be billable. SKYDEVOPS/I/WE do not take any responsibility if the guide causes any serious damage or issues, which you have to take full responsibility.

Following are few useful cURL commands, categorised as below;

  • User Management Commands
  • Package Management Commands
  • OSGi Bundle Management Commands
  • JCR Query Builder Commands
  • Backup Commands
  • JCR Node Management Commands
  • Replication Commands
  • Page Management Commands
  • Other useful commands 

 

USER MANAGEMENT COMMANDS:

[code lang=’bash’ title=’Create a new User’]
$ curl -u admin:admin -FcreateUser= -FauthorizableId=skydevops-Frep:password=skydevops http://localhost:4502/libs/granite/security/post/authorizables
[/code]

[code lang=’bash’ title=’Create a new user under specified folder’]
$ curl -u admin:admin -FcreateUser= -FauthorizableId=testuser -Frep:password=testuser -FintermediatePath=”/home/users/test/” http://localhost:4502/libs/granite/security/post/authorizables
[/code]

[code lang=’bash’ title=’Create a new Group’]
$ curl -u admin:admin -FcreateGroup=testgroup -FauthorizableId=testGroup http://localhost:4502/libs/granite/security/post/authorizables
[/code]

[code lang=’bash’ title=’Add a Property to an existing User’]
$ curl -u admin:admin -Fprofile/age=30 http://localhost:4502/home/users/a/skydevops.rw.html
[/code]

[code lang=’bash’ title=’Create a User with a profile’]
$ curl -u admin:admin -FcreateUser=testuser -FauthorizableId=skydevopsa -Frep:password=skydevops -Fprofile/gender=male http://localhost:4502/libs/granite/security/post/authorizables
[/code]

[code lang=’bash’ title=’Create a new User as a member of a Group’]
$ curl -u admin:admin -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abcd123 -Fmembership=contributor http://localhost:4502/libs/granite/security/post/authorizables
[/code]

[code lang=’bash’ title=’Add User to a Group’]
$ curl -u admin:admin -FaddMembers=testuser http://localhost:4502/home/groups/t/testGroup.rw.html
[/code]

[code lang=’bash’ title=’Remove a User from a Group’]
$ curl -u admin:admin -FremoveMembers=testuser http://localhost:4502/home/groups/t/testGroup.rw.html
[/code]

[code lang=’bash’ title=’Set a User’s Group Memberships’]
$ curl -u admin:admin -Fmembership=contributor -Fmembership=testgroup http://localhost:4502/home/users/t/testuser.rw.html
[/code]

[code lang=’bash’ title=’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
[/code]

[code lang=’bash’ title=’Change a 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:admin http://localhost:4502/home/users/a/shashi@skydevops.in
[/code]

 

PACKAGE MANAGEMENT COMMANDS:

[code lang=’bash’ title=’list of all the packages’]
$ curl -u admin:admin http://localhost:4502/crx/packmgr/service.jsp?cmd=ls
[/code]

[code lang=’bash’ title=’Build or Rebuild an existing package’]
$ curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/samplepackage.zip?cmd=build
[/code]

[code lang=’bash’ title=’Delete a package’]
$ curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/samplepackage.zip?cmd=delete
[/code]

[code lang=’bash’ title=’Install a package’]
$ curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/samplepackage.zip?cmd=install
[/code]

[code lang=’bash’ title=’Uninstall a package’]
$ curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/samplepackage.zip?cmd=uninstall
[/code]

[code lang=’bash’ title=’Download a package into local filesystem’]
$ curl -u admin:admin http://localhost:4502/etc/packages/my_packages/samplepackage.zip >
[/code]

[code lang=’bash’ title=’Upload but don’t install a package from File system’]
$ curl -u admin:admin -F file=@”C:\sample\samplepackage.zip” -F name=”samplepackage” -F force=true -F install=false http://localhost:4502/crx/packmgr/service.jsp
[/code]

[code lang=’bash’ title=’Upload and Install a package from File system’]
$ curl -u admin:admin -F file=@”C:\sample\samplepackage.zip” -F name=”samplepackage” -F force=true -F install=true http://localhost:4502/crx/packmgr/service.jsp
[/code]

 

OSGI BUNDLE MANAGEMENT:

[code lang=’bash’ title=’Build a Bundle using’]
$ curl -u admin:admin -F bundleHome=/apps/training/src/com.day.sample -F descriptor=/apps/training/src/com.day.sample/com.day.sample.bnd http://localhost:4502/libs/crxde/build
[/code]

[code lang=’bash’ title=’Start a Bundle using’]
$ curl -u admin:admin http://localhost:4502/system/console/bundles/com.day.sample -Faction=start
[/code]

[code lang=’bash’ title=’Stop a Bundle using’]
$ curl -u admin:admin http://localhost:4502/system/console/bundles/com.day.sample -Faction=stop
[/code]

[code lang=’bash’ title=’Install a Bundle from File system using’]
$ curl -u admin:admin -F action=install -F bundlestartlevel=20 -F bundlefile=@”” http://localhost:4502/system/console/bundles
[/code]

 

JCR QUERY BUILDER:

[code lang=’bash’ title=’Find an Asset from the JCR’]
$ curl -s -u admin:admin GET “http://localhost:4502/bin/querybuilder.json?path=%2fcontent%2fgeometrixx%2fen&property=fileReference&property.value=%2fcontent%2fdam%2fgeometrixx%2fshapes%2ftri_equilateral.png&type=nt%3aunstructured”
[/code]

 

BACKUP COMMANDS:

[code lang=’bash’ title=’Initiate backup’]
$ curl -u admin:admin -X POST http://localhost:4502/system/console/jmx/com.adobe.granite%3Atype%3DRepository/op/startBackup/java.lang.String?target=C:\sampleFolder\backupTest.zip
[/code]

[code lang=’bash’ title=’Stop a running Backup’]
$ curl -u admin:admin -X POST http://localhost:4502/libs/granite/backup/content/admin/backups.cancel.html
[/code]

 

JCR NODE MANAGEMENT COMMANDS:

[code lang=’bash’ title=’Delete a Node’]
$ curl -X DELETE http://localhost:4502/content/geometrixx/en/products/jcr:content/par/flash -u admin:admin
[/code]

[code lang=’bash’ title=’Create or Add a Node’]
$ curl –data jcr:primaryType=nt:unstructured –user admin:admin http://localhost:4502/content/geometrixx/en/toolbar/testNode
[/code]

 

REPLICATION COMMANDS:

[code lang=’bash’ title=’Activate Page’]
$ curl -u admin:admin -X POST -F path=”/content/geometrixx/en/pag” -F cmd=”activate” http://localhost:4502/bin/replicate.json
[/code]

[code lang=’bash’ title=’Deactivate Page’]
$ curl -u admin:admin -X POST -F path=”/content/geometrixx/en/pag” -F cmd=”deactivate” http://localhost:4502/bin/replicate.json
[/code]

[code lang=’bash’ title=’Tree Activation’]
$ curl -u admin:admin -F cmd=activate -F ignoredeactivated=true -F onlymodified=true -F path=/content/geometrixx/en/community http://localhost:4502/etc/replication/treeactivation.html
[/code]

 

PAGE MANAGEMENT COMMANDS:

[code lang=’bash’ title=’Lock a Page’]
$ curl -u admin:admin -X POST -F cmd=”lockPage” -F path=”/content/geometrixx/en/toolbar/contacts” -F “_charset_”=”utf-8″ http://localhost:4502/bin/wcmcommand
[/code]

[code lang=’bash’ title=’Unlock a Page’]
$ curl -u admin:admin -X POST -F cmd=”unlockPage” -F path=”/content/geometrixx/en/toolbar/contacts” -F “_charset_”=”utf-8” http://localhost:4502/bin/wcmcommand
[/code]

[code lang=’bash’ title=’Copy or Move a Page’]
$ curl -u admin:admin -F:operation=copy -F:dest=/content/geometrixx/en/products/contacts http://localhost:4502/content/geometrixx/en/toolbar/contacts
[/code]

 

OTHER USEFUL COMMANDS:

[code lang=’bash’ title=’Datastore Garbage Collection’]
$ curl -u admin:admin -X POST http://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/op/runDataStoreGarbageCollection/java.lang.Boolean
[/code]

[code lang=’bash’ title=’Tar Optimization’]
$ curl -u admin:admin -X POST http://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/op/startTarOptimization/
[/code]

[code lang=’bash’ title=’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
[/code]

 

Shashi View All

-== Superman ==-

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: