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 

Preview a package 


List Package content 


Install a package 


Other useful curl command can be found - 

https://experienceleague.adobe.com/docs/experience-manager-64/administering/operations/curl.html?lang=en

Comments

Popular Posts

AdobeDispatcherHacks ".statfile"

how to clear dispatcher cache in aem ?

How to Increase Apache Request Per Second ?

How Does S3 works with AEM ?

How to Sync HMAC in AEM ?

Configure/Decoding AEM AuditLogs

AEM Security Headers

Dispatcher flush from AEM UI

How to protect AEM against CSRF Attack ?

How to prevent DDoS in Apache ?