Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

curl command AEM package filter addition creation | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

curl command AEM package filter addition creation by Anuj Gangwar

Abstract

Most of our dev ops and AEM developers face issue while automating the AEM package creation via Curl.

I will explain the command and process for it.

in AEM package creation is a 3 steps process.

1- AEM package creation

2 - Filter addition

3- Package build

Let's see all these 3 steps in detail -

AEM package creation
it is simple step -

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
Filter Addition
This is a complex step where you need to be careful while adding the parameters.

General command , in this "/content/my-site" is my package filter. You can also define the rule like exclude in exclude section.

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'
Command with multiple filters and no exclude rules.
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-site1\", \"rules\": []},{\"root\" : \"/content/my-site2\", \"rules\": []},{\"root\" : \"/content/my-site3\", \"rules\": []}]" \
-F '_charset_=UTF-8'
Build AEM Package
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/testpackage.zip?cmd=build
Download package
curl -u : http://localhost:4502/etc/packages/my_packages/testpackage
.zip
Other useful commands for package
Preview a package

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

Read Full Blog

curl command AEM package filter addition creation

Q&A

Please use this thread to ask the related questions.

0 Replies