Remote Publishing / Bundle API documentation for the dotCMS Content Management System

dotCMS allows users to create bundles of content / sites / templates / content types and other objects that can be used for batch remote publishing or even in a CI/CD process. Below are example commands on how to use the RemotePublishAjaxAction endpoint to create and manage bundles via api. This endpoint allows you to use the API to :

  • Create bundles
  • Add content / sites / content types to bundles
  • Push Publish bundles
  • Download bundles
  • Upload bundles

First, store AUTH Token

export TOK=`curl -H "Content-Type:application/json" -s -X POST http://localhost:8080/api/v1/authentication/api-token -d  '
{ 
    "user":"admin@dotcms.com", 
    "password":"admin", 
    "expirationDays": 1, 
    "label":"for testing" 
}'  | python -c 'import json,sys;print json.load(sys.stdin)["entity"]["token"]'`

Add an object to bundle by Id (any object, not just content)

This will create or append an asset to a bundle with the name and/or id specified. In this example, it will create a new bundle and it will add to the home page template to it.

curl -H "Content-Type: application/json" -H "Authorization:Bearer $TOK" -XPOST  http://localhost:8080/DotAjaxDirector/com.dotcms.publisher.ajax.RemotePublishAjaxAction/cmd/addToBundle -d '
{
    "assetIdentifier": "71bf1747-56b9-41ca-a3fa-1fc7b8471dba",
    "bundleName":"testing",
    "bundleId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa"
}
'

Add add a contentType by query

You can add content to a bundle using a content query. When content is added to a bundle, the content type definitions of the content are added by dependency.

curl -H "Content-Type: application/json" -H "Authorization:Bearer $TOK" -XPOST  http://localhost:8080/DotAjaxDirector/com.dotcms.publisher.ajax.RemotePublishAjaxAction/cmd/addToBundle -d '
{
    "query": "+contenttype:news",
    "bundleId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa"
}
'

Add add a Site by name

You can also add a Site to a bundle using a content query. When a site is added to a bundle, all the content/templates and containers beloging the site are added by dependency.

curl -H "Content-Type: application/json" -H "Authorization:Bearer $TOK" -XPOST  http://localhost:8080/DotAjaxDirector/com.dotcms.publisher.ajax.RemotePublishAjaxAction/cmd/addToBundle -d '
{
    "query": "+host.hostname:demo.dotcms.com +live:true",
    "bundleName":"testing"
}
'

Push the bundle , using the {bundleId} from the above call and a comma separated list of {UUIDs} of the environments you want to send to

This tells dotCMS to push the bundle to push the bundle to the environments specified by the whoToSend parameter, which takes a comma separated list of environments to push to.

curl -H "Content-Type: application/json" -H "Authorization:Bearer $TOK" -XPOST  http://localhost:8080/DotAjaxDirector/com.dotcms.publisher.ajax.RemotePublishAjaxAction/cmd/pushBundle -d '
{
    "assetIdentifier": "{bundleId}",
    "remotePublishDate":"2001-01-01",
    "remotePublishTime":"10-00",
    "remotePublishExpireDate":"2051-01-01",
    "remotePublishExpireTime":"10-00",
    "iWantTo":"publish|expire",
    "whoToSend":"UUID-prod-environ1,UUID-prod-environ2",
    "forcePush":true|false
}
'

Download the bundle as a .tar.gz file

Bundles can be downloaded for (publish|unpublish) depending on what operation you want your bundle to perform.

curl -H "Content-Type: application/json" -H "Authorization:Bearer $TOK" -XPOST  --output my-bundle.tar.gz http://localhost:8080/DotAjaxDirector/com.dotcms.publisher.ajax.RemotePublishAjaxAction/cmd/downloadUnpushedBundle -d '
{
    "bundleId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa",
    "paramOperation": "publish"
}
'