curl command AEM package filter addition creation
How to create AEM package via CURL
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 <user>:<password> http://localhost:4502/etc/packages/my_packages/testpackage
.zip
.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
List Package content
curl -u <user>:<password> -X POST http://localhost:4502/crx/packmgr/service/console.html/etc/packages/mycontent.zip?cmd=contents
Install a package
curl -u <user>:<password> -F cmd=install http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/test.zip
Other useful curl command can be found -
https://experienceleague.adobe.com/docs/experience-manager-64/administering/operations/curl.html?lang=en
Comments
Post a Comment