Showing posts with label Curl. Show all posts
Showing posts with label Curl. Show all posts

Wednesday, 29 March 2017

Monday, 16 November 2015

Creating package with filters/exclusion using cUrl

The article [1] explains managing Packages on the Command Line.  In this blog post providing an sample to add the filter definitions with exclusion using cUrl[2].  CQ 5.5 uses multipart/form-data to POST the data.  The command [2] referenced is for cq5.5 onwards.  In case it is cq5.4 please use [3].

As an example for cq5.5 onwards the cUrl command to add a filter definition /content/geometrixx/en and to exclude all the page below /content/geometrixx/en that starts with range a to z for already existing package ( and group mygroup is

curl -u admin:admin -X POST -F 'path=/etc/packages/mygroup/' -F 'packageName=test' -F 'groupName=mygroup' -F 'version=2' -F 'filter=[{"root":"/content/geometrixx/en","rules":[{"modifier":"exclude","pattern":"/content/geometrixx/en/[a-z].*"}]}]' -F '_charset_=UTF-8'  http://localhost:4502/crx/packmgr/update.jsp

Sample curl command for cq5.4 to add two filters below

curl -u admin:admin -X POST --data _charset_=UTF-8 --data groupName=mygroup --data version=3 --data filter='[{"root":"/apps/cq/analytics/widgets/js.txt","rules":[]},{"root":"/etc/blueprints/geometrixx/jcr:content/thumbnail","rules":[]}]' --data packageName=test --data path=/etc/packages/mygroup/ http://localhost:4502/crx/packmgr/update.jsp


[2]   CQ 5.5 Onwards includes AEM 5.6 etc...

curl -u <uid>:<pwd> -X POST -F 'path=<full_path_of_package>' -F 'packageName=<packageName>' -F 'groupName=<group_name>' -F 'version=<Version_Number>' -F 'filter=<array_of_filter_definitions_containing_root_and_pattern>' -F '_charset_=UTF-8'  http://<host>:<port>/crx/packmgr/update.jsp

[3]   CQ 5.4 & Below

curl -u admin:admin -X POST --data _charset_=UTF-8 --data groupName=<group_name> --data version=<Version_Number> --data filter='<array_of_filter_definitions_containing_root_and_pattern>' --data packageName=<packageName> --data path=<full_path_of_package> http://<host>:<port>/crx/packmgr/update.jsp