Updating an existing package through CURL | Community
Skip to main content
January 11, 2017
Solved

Updating an existing package through CURL

  • January 11, 2017
  • 8 replies
  • 5601 views

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.
Best answer by kautuk_sahni

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

8 replies

kautuk_sahni
Community Manager
Community Manager
January 12, 2017

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
January 12, 2017

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.

January 12, 2017

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.

January 16, 2017

Bump....anyone?

January 16, 2017

Bump....anyone?

smacdonald2008
Level 10
January 16, 2017

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

smacdonald2008
Level 10
January 16, 2017

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

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
June 6, 2017

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