Updating an existing package through CURL | Community
Skip to main content
Jan 11, 2017 9:15 PM UTC
Solved

Updating an existing package through CURL

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Employee
Jun 6, 2017 6:40 AM UTC

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

8 replies

kautuk_sahni
kautuk_sahniAccepted solution
Employee
Jun 6, 2017 6:40 AM UTC

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

Translate
Kautuk Sahni
smacdonald2008
Level 10
Jan 16, 2017 5:03 PM UTC

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

Translate
smacdonald2008
Level 10
Jan 16, 2017 5:03 PM UTC

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

Translate
Jan 16, 2017 2:51 PM UTC

Bump....anyone?

Translate
Jan 16, 2017 2:51 PM UTC

Bump....anyone?

Translate
Jan 12, 2017 2:22 PM UTC

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.

Translate
Jan 12, 2017 2:22 PM UTC

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.

Translate
kautuk_sahni
Employee
Jan 12, 2017 8:56 AM UTC

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

Translate
Kautuk Sahni