Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Updating an existing package through CURL

Avatar

Former Community Member

Hi,

I am using a series of CURL request to create my package.

What I am doing currently: I created a new package, added filters to it and then built the package.

What I want to do: Add more filters to this package and build it again.

I am wondering if there is a way to update an existing package. I have been searching around to see how we can do this but have failed. Can someone please help me?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Administrator

I don't think there is option to append the filters.

You need use:-

For adding filters:

# 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'

Source Link:- AEM/CQ cURL: Adding include/exclude rules to package filters · GitHub

~kautuk



Kautuk Sahni

View solution in original post

8 Replies

Avatar

Administrator

Hi 

For adding filters:

# 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

 

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

 

Reference posts are:- 

Link:- https://gist.github.com/sergeimuller/2916697

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

I hope this would help you.

~kautuk



Kautuk Sahni

Avatar

Former Community Member

kautuksahni wrote...

Hi 

For adding filters:

# 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

 

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

 

Reference posts are:- 

Link:- https://gist.github.com/sergeimuller/2916697

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

I hope this would help you.

~kautuk

 

Yeah I have done this already. My issue is how do I add more filters to this existing package? If I add filters it overwrites the existing ones. I want to add them instead of overwriting the existing filters.

Avatar

Former Community Member

kautuksahni wrote...

Hi 

For adding filters:

# 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

 

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

 

Reference posts are:- 

Link:- https://gist.github.com/sergeimuller/2916697

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

I hope this would help you.

~kautuk

 

Yeah I have done this already. My issue is how do I add more filters to this existing package? If I add filters it overwrites the existing ones. I want to add them instead of overwriting the existing filters.

Avatar

Level 10

I believe Kautuk answer is the best you will get here. Even when you build with Package Manager - it overwrites existing ones. 

Avatar

Level 10

I believe Kautuk answer is the best you will get here. Even when you build with Package Manager - it overwrites existing ones. 

Avatar

Correct answer by
Administrator

I don't think there is option to append the filters.

You need use:-

For adding filters:

# 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'

Source Link:- AEM/CQ cURL: Adding include/exclude rules to package filters · GitHub

~kautuk



Kautuk Sahni