Fork me on GitHub

Command Line Examples To Export Content

Export Content to a Package ZIP

In this section, we will see how to export binaries and documents from the Demo Application.

After running the Demo Application, let's export binaries and documents with the following ExecutionParams JSON file.

$ cat export-params.json
{
  binaries: {
    queries: [
      '/jcr:root/content//element(*,hippo:document)[@jcr:primaryType=\'hippogallery:imageset\' or @jcr:primaryType=\'hippogallery:exampleAssetSet\']'
    ]
  },
  documents: {
    queries: [
      '/jcr:root/content/documents//element(*,hippo:document)'
    ]
  }
}
          
$ curl -i \
    -F "params=@export-params.json" \
    -u admin:admin \
    -o exim.zip \
    http://localhost:8080/cms/ws/exim/export

...
          
$ unzip -l exim.zip

Archive:  exim.zip
warning [exim.zip]:  216 extra bytes at beginning or within zipfile
  (attempting to process anyway)
  Length      Date    Time    Name
---------  ---------- -----   ----
     6326  02-01-2018 20:36   EXIM-INF/summary-binaries.log
     8792  02-01-2018 20:36   EXIM-INF/summary-documents.log
   244798  02-01-2018 20:36   content/gallery/contenteximdemo/banners/banner-2.jpg/banner-2.jpg.json
   222906  02-01-2018 20:36   content/gallery/contenteximdemo/banners/banner-1.jpg/banner-1.jpg.json
    21357  02-01-2018 20:36   content/gallery/contenteximdemo/samples/coffee-206142_150.jpg/coffee-206142_150.jpg.json
...
     4615  02-01-2018 20:36   content/documents/contenteximdemo/news/2017/07/the-medusa-news/the-medusa-news.json
     4609  02-01-2018 20:36   content/documents/contenteximdemo/news/2017/07/2013-harvest/2013-harvest.json
     4634  02-01-2018 20:36   content/documents/contenteximdemo/news/2017/07/the-gastropoda-news/the-gastropoda-news.json
...
---------                     -------
  1045398                     34 files
          

You can also pass paramsJson form parameter instead of params file attachment:

$ curl -i \
    -F "paramsJson={ documents: { queries: [ '/jcr:root/content/documents//element(*,hippo:document)' ] } }" \
    -u admin:admin \
    -o exim.zip \
    http://localhost:8080/cms/ws/exim/export

...
          

You got a content package ZIP file (e.g, exim.zip) based on the ExecutionParams!