Expand my Community achievements bar.

SOLVED

adding/updating the fiters using curl command in 6.1

Avatar

Level 5

Hi All,

Curl command for adding/updating the fiters  in 6.1.

 

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Mahesh,

You can find very good content about the curl and its commands here: https://hashimkhan.in/2015/05/27/aem-with-curl/
Hope this helps!

Thanks,
Ratna Kumar.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi Mahesh,

You can find very good content about the curl and its commands here: https://hashimkhan.in/2015/05/27/aem-with-curl/
Hope this helps!

Thanks,
Ratna Kumar.

Avatar

Administrator

Hi 

Adding the reference article:-

Link:- https://gist.github.com/nateyolles/dd4ebe0a6b83c369029b

//AEM/CQ cURL: Adding include/exclude rules to package filters

# create package
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/testpackage?cmd=create \
-d packageName=testpackage \
-d groupName=my_packages

# add filters
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/update.jsp \
-F path=/etc/packages/my_packages/testpackage.zip -F packageName=testpackage \
-F groupName=my_packages \
-F filter="[{\"root\" : \"/content/my-site\", \"rules\": [{\"modifier\" : \"exclude\", \"pattern\" : \"/content/my-site/(.*)/folder-to-exclude(/.*)?\"}]}]" \
-F '_charset_=UTF-8'

# build package
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/testpackage.zip?cmd=build

 

Link: http://aemfaq.blogspot.in/2013/09/creating-package-with-filtersexclusion.html

//

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 (test-2.zip) and group mygroup is

curl -u admin:admin -X POST -F 'path=/etc/packages/mygroup/test-2.zip' -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/test-test-2.zip http://localhost:4502/crx/packmgr/update.jsp

[1]    http://dev.day.com/docs/en/crx/current/how_to/package_manager.html

[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

 

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni