aemcrx

CQ5.5 Updating an existing package through CURL


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.

Create package:

curl -f -N -u ${USER}:${PASS} -d "packageName=${PACKAGE}&groupName=${GROUP}" "${CMS_HOST}/crx/packmgr/service/exec.json?cmd=create"

Apply Filters:

curl -f -N -u ${USER}:${PASS} -F "path=/etc/packages/${GROUP}/${PACKAGE}.zip" -F "packageName=${PACKAGE}" -F "groupName=${GROUP}" -F "version=" -F "description=" -F "thumbnail=" -F "filter=${FILTER}" -F "_charset_=UTF-8" "${CMS_HOST}/crx/packmgr/update.jsp"

Build Package:

curl -f -N -u ${USER}:${PASS} -d "cmd=build" "${CMS_HOST}/crx/packmgr/service/script.html/etc/packages/${GROUP}/$PACKAGE.zip"

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.

Update: Added the CURL commands I am using.


Solution

  • Here you go with an example where i have a package with two filters already Package with filters

    Going to add another filter

    CURL for Create a Filter Node

    curl --data jcr:primaryType=nt:unstructured --user admin:admin http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2
    

    Add the Filter properties

    curl -u admin:admin -Froot="/content/geometrixx-outdoors/en/toolbar" http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html
    

    IF required add additional properties (i.e. "mode" & "rules") for the Default package behaviour

    curl -u admin:admin -Fmode="replace" http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html
    
    curl -u admin:admin -Frules@TypeHint="String[]" -Frules=" " -Frules=" "http://localhost:4502/etc/packages/my_packages/testcurl.zip/jcr:content/vlt:definition/filter/f2.rw.html
    

    Finally build your package to affect additional filter to add to your existing package

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

    Final updated package