Skip to content

Package Management REST API

The AEM Package manager can be accessed through a REST API

$ curl -D- -u cmsadmin https://cmsa-test-p-01.db.vt.edu/crx/packmgr/service.jsp
Enter host password for user 'cmsadmin':
HTTP/1.1 200 OK
Date: Wed, 24 Oct 2018 18:42:11 GMT
Server: Apache
Content-Type: text/plain; charset=utf8
X-RouteInfo: cmsa-test-p-01
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=604800; includeSubDomains
Content-Length: 2803

The credential for cmsadmin can be found in the Pass dbaa-credential store under web/cms/jenkins-cmsadmin-{tier}

<crx version="1.8.7" user="cmsadmin" workspace="crx.default">                                                                          [11/1832]
  <request>
  </request>
  <response>
    <data>
      +------------+-----------------------------------------+
      |  Arguments | Comment                                 |
      +------------+-----------------------------------------+
      |  cmd=help  | print this help                         |
      +------------+-----------------------------------------+
      |  cmd=ls    | print a list of all packages            |
      +------------+-----------------------------------------+
      |  POST      | remove a  package                       |
      |  cmd=rm    |                                         |
      |  name      | package name                            |
      |  [group]   | group name (optional)                   |
      +------------+-----------------------------------------+
      |  POST      | build a  package                        |
      |  cmd=build |                                         |
      |  name      | package name                            |
      |  [group]   | group name (optional)                   |
      +------------+-----------------------------------------+
      |  POST      | install a package                       |
      |  cmd=inst  |                                         |
      |  name      | package name                            |
      |  [strict]  | true to fail on error                   |
      |  [group]   | group name (optional)                   |
      +------------+-----------------------------------------+
      |  POST      | uninstall a package                     |
      |  cmd=uninst|                                         |
      |  name      | package name                            |
      |  [group]   | group name (optional)                   |
      +------------+-----------------------------------------+
      |  GET       | download a package                      |
      |            | (content-disposition header contains    |
      |            | the correct filename)                   |
      |  [cmd=get] | optional                                |
      |  name      | package name                            |
      |  [group]   | group name (optional)                   |
      +------------+-----------------------------------------+
      |  POST      | upload a new package                    |
      |  file      | package to upload                       |
      |  [name]    | optional name                           |
      |  [strict]  | true to fail on install error           |
      |  [install] | automatically install package if 'true' |
      +------------+-----------------------------------------+
    </data>
    <status code="200">ok</status>
  </response>
</crx>

Upload a Package

The Web GUI version of the Package manager (/crx/packmgr/index.jsp) often times out when uploading a large package (expecially over a slow network).

We can use cURL to upload -- this is best when you can stage the large package file on a machine closer to your target and on a fast network.

curl -X POST -u admin https://cmsa-dvlp-01.db.vt.edu/crx/packmgr/service.jsp\?cmd\=upload -F file=@aem-6.4.8-cfp-3.0.zip   
Enter host password for user 'admin':
<crx version="1.8.15" user="admin" workspace="crx.default">
  <request>
    <param name="cmd" value="upload"/>
    <param name="file" value="aem-6.4.8-cfp-3.0.zip"/>
  </request>
  <response>
    <data>
      <package>
        <group>adobe/cq640/cumulativefixpack</group>
        <name>aem-6.4.8-cfp</name>
        <version>3.0</version>
        <downloadName>aem-6.4.8-cfp-3.0.zip</downloadName>
        <size>136519630</size>
        <created></created>
        <createdBy>Adobe Systems Incorporated</createdBy>
        <lastModified></lastModified>
        <lastModifiedBy>null</lastModifiedBy>
        <lastUnpacked></lastUnpacked>
        <lastUnpackedBy>null</lastUnpackedBy>
      </package>
    </data>
    <status code="200">ok</status>
  </response>
</crx>