Wednesday, December 21, 2011

How to manage bundle using curl command

Get bundle Symbolic Name:

(You can use jsawk tool to parse this data as well

curl -u admin:admin http://localhost:4502/system/console/bundles</bundlenumber>.json

curl -u admin:admin -F action=start http://localhost:4502/system/console/bundles/$bundle symbolic name

curl -u admin:admin -F action=stop http://localhost:4502/system/console/bundles/$bundle symbolic name

curl -u admin:admin -F action=update http://localhost:4502/system/console/bundles/$bundle symbolic name

curl -u admin:admin -F action=refresh http://localhost:4502/system/console/bundles/$bundle symbolic name

curl -u admin:admin -F action=uninstall http://localhost:4502/system/console/bundles/$bundle symbolic name
curl -XDELETE -u user:pass http://.../apps/${app}/install/${bundle-file-name}

curl -X POST -v -F action=install -F bundlestart=start -F bundlestartlevel=20 -F bundlefile=/path/to/jar/file.jar http://admin:admin@localhost:4502/system/console/bundles
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F bundlefile=@"/path/of/jar" http://localhost:9002/system/console/bundles

Here is some example with jswak (Here is how you can install jswak on MAC)
How to check if a CQ bundle is Active

curl -u admin:admin http://localhost:4502/system/console/bundles/<bundle number or symbolic name>.json | jsawk -n 'if([0].state=="Active")' | echo "Bundle is Active"

How to check if All bundles are active

curl -u admin:admin http://localhost:4502/system/console/bundles/<bundle number or symbolic name>.json | jsawk -n 'if(this.s[3] + this.s[4] > 0)' | echo "There is some problem not all bundle is active"

Find all Bundle having some problems

curl -u admin:admin http://localhost:4502/system/console/bundles.json | jsawk -n 'for(var i=0;i<;i++) {if([i].state!="Active" &&[i].state!="Fragment") out("Bundle " +[i].symbolicName+"  is "+[i].state)}'



  1. Hi Yogesh,

    I am using install command -

    C:\Users\ssha49\Desktop\infra scripts>curl -X POST -v -F "action=install" -F "bundlestart=start" -F "bundlestartlevel=20" -F "bundlefile=C:\Users\ssha49\Desktop\gsamjars\search-1.1.jar" http://admin:admin@localhost:4502/system/console/bundl
    but I am getting error -
    * About to connect() to localhost port 4502 (#0)
    * Trying
    * connected
    * Connected to localhost ( port 4502 (#0)
    * Server auth using Basic with user 'admin'
    > POST /system/console/bundles HTTP/1.1
    > Authorization: Basic YWRtaW46YWRtaW4=
    > User-Agent: curl/7.28.1
    > Host: localhost:4502
    > Accept: */*
    > Content-Length: 506
    > Expect: 100-continue
    > Content-Type: multipart/form-data; boundary=------------------------
    < HTTP/1.1 100 Continue
    < HTTP/1.1 302 Moved Temporarily
    < Connection: Keep-Alive
    < Server: Day-Servlet-Engine/4.1.24
    < Content-Type: text/html
    < Date: Mon, 04 Feb 2013 09:51:22 GMT
    < Transfer-Encoding: chunked
    < Location: /system/console/bundles
    * HTTP error before end of send, stop sending

    This page moved to /system/console/bundles

    * Closing connection #0

    1. I just updated CURL command. Can you try now ?

    2. Hi Yogesh, I have tried the same curl command to install a jar in AEM but I am also getting the same error as that of Mr. Sujeeth. Can you help me regarding this.

    3. Can you please use curl -u admin:PASSWORD -F action=install -F bundlestart=start -F bundlestartlevel=20 -F bundlefile=/path/to/jar/file.jar http://HOST:PORT/system/console/bundles Let me know if that helps. Also what version of CQ are you using ?

  2. Excellent post, Yogesh. Is it be possible to refresh bundle configuration with CURL as well?

    1. Yes. You can refresh bundle as well. I have command for that listed above. Let me know if that does not work. Note that you need to use bundle symbolic name for that.

  3. Hi Yogesh, for bundle, we can just update/ activate/update via package: /apps/${app}/install/${bundle-file-name}
    any implications on doing that?
    sometimes i noticed that the bundle is not being updated. is it because of the version on META-INF? or anything else?

    1. Hello Mildred,

      Bundle only get update if new bundle version is either greater than current installed bundle version or it is same as current installed version but have SNAPSHOT in version number.

      For example,

      Current is 1.0.0 and new is 1.0.1 -> update happen
      Current is 1.0.2 and new is 1.0.1 -> update will not happen
      Current is 1.0.2 and new is 1.0.1-SNAPSHOT -> update will not happen
      Current is 1.0.2 and new is 1.0.2-SNAPSHOT -> update will happen
      Current is 1.0.2-SNAPSHOT and new is 1.0.2-SNAPSHOT -> update will happen
      Current is 1.0.2-SNAPSHOT and new is 1.0.1-SNAPSHOT -> update will not happen


  4. Hi Yogesh ,

    Do you know how to create a cq node with Long type ?

    1. Hello Madhavan,

      Do you mean create a node with Long property ? For that you can use sling post servlet. Here is example


  5. Hi Yogesh,

    I tried the command but not sure if it ran successfully or not. I did not receive any response to the command.

    I do not have access to Felix console, so
    - Is there a way to find out if a particular bundle exists or got installed
    - To star the bundles, how to find the bundle symbolic name

    1. For bundle symbolic name just query bundles.json and then use any json parser tool to find it.

  6. Do we have any cURL command to check the status of the bundle? If so,could you please suggest. Thanks in advance.

    1. Hello Swathi,

      You can use curl with jswak to check this. I have added some example for your reference above. Please let me know if that helps.


  7. Wheely | The largest platform to play wheely online games in 2019. We have a number of fun games for kids both boys and girls.