Wednesday, March 8, 2023

Using cURL with Upload Packages | Bundles in AEM








In this article, we will learn how we can  perform the following actions using cURL in AEM

  • The list of already installed Packages on the AEM instance 
  • Uninstall any Package from the AEM instance
  • Delete any Package from the AEM instance
  • Upload any Package to the AEM instance
  • Install the uploaded Package on the AEM instance

How to apply all above-listed actions on the AEM author instance

 

List Packages cURL command syntax

  • curl -u admin:admin http://<host>:<port>/crx/packmgr/service.jsp?cmd=ls

Uninstall Packages cURL command syntax

  • curl -u <user>:<password> -F cmd=uninstall http://localhost:4502/ crx/packmgr/service/.json/etc/packages/my_packages/test.zip

 Delete Packages cURL command syntax

  • curl -u <user>:<password> -F cmd=delete http://localhost:4502/ crx/packmgr/service/.json/etc/packages/my_packages/test.zip

Upload Packages cURL command syntax

  • curl -u <user>:<password> -F cmd=upload -F force=true -F package=@test.zip http://localhost:4502/crx/packmgr/service/.json

Install Packages cURL command syntax

  • curl -u <user>:<password> -F cmd=install http://localhost:4502/crx/packmgr/ service/.json/etc/packages/my_packages/test.zip

NOTE:
In the upload command after @ you need to add the path from which you want to upload package to the instance
In the above commands, after etc you need to add the path of your packages from the instance and in the bottom image, you can find where ur packages are saved after uploading on the AEM instance 


Bundle Installation using cURL


Author Instance

  • curl -u admin:admin -F action=install -F bundlestartlevel=20 -F bundlefile=@"core/target/cxp-wp.core-1.0.jar" http://localhost:4502/system/console/bundles 

Go to http://localhost:4502/system/console/components
and search here for your servlet name then you will find that your bundles are installed

Publish Instance

  • curl -u admin:admin -F action=install -F bundlestartlevel=20 -F bundlefile=@"core/target/cxp-wp.core-1.0.jar" http://localhost:4503/system/console/bundles 
Go to http://localhost:4503/system/console/components
and search here for your servlet name then you will find that your bundles are installed

NOTE:
if your bundle is installed but you are unable to find it in the search,
(maybe it installed but not started) to start your bundle follow the bottom instructions

  • go to http://localhost:4503/system/console/status-Bundles
  • Search your servlet here if you found then copy its id 




  • goto http://localhost:4503/system/console/bundles/ur bundle id
  • follow bottom image


if your bundle is stopped then click to play button and start this and then go back to your  http://localhost:4503/system/console/components and search here your servlet (hope it will work for you)




Reference: AEM official documentation









Previous Post
Next Post

post written by:

0 comments: