adding/updating the fiters using curl command in 6.1

Avatar

Avatar
Validate 25
Level 3
Mahesh_Vikram
Level 3

Likes

12 likes

Total Posts

118 posts

Correct reply

3 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
Mahesh_Vikram
Level 3

Likes

12 likes

Total Posts

118 posts

Correct reply

3 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Mahesh_Vikram
Level 3

25-04-2016

Hi All,

Curl command for adding/updating the fiters  in 6.1.

 

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

25-04-2016

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.

Answers (2)

Answers (2)

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,198 likes

Total Posts

6,383 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,198 likes

Total Posts

6,383 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

25-04-2016

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

Avatar

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile
Hemant_arora
Level 7

25-04-2016