DotAjaxDirector API documentation for the dotCMS Content Management System

The DotAjaxDirector API allows you to perform a number of actions which are performed by the dotCMS back-end, in a RESTful fashion.

The following examples demonstrate some of the most common uses of the DotAjaxDirector API.

Store AUTH Token

The following example stores an AUTH token which can be used by external applications to access dotCMS.

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

Working with Bundles

Add Objects to Bundles

You can add objects to Bundles using the DotAjaxDirector API.

  • You may append any type of object to the bundle, not just content.
  • If there is an existing Bundle with the given name and/or Id, the object will be appended to that bundle.
    • Otherwise, if a Bundle name (but not Id) is supplied, and that Bundle does not exist, a new bundle with that name will be created.

Add an Object to a Bundle

The following example save a bundle with the Name and/or Id you specify to the specified Bundle.

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 a Content Type to a Bundle Using a Query

The following example adds a Content Type to a Bundle:

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 a Site to a Bundle

The following example adds an entire Site to a Bundle:

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 a Bundle

The following example pushes a Bundle (as specified by the assetIdentifier property) to the specified Push Publishing Environments (as specified by the whoToSend property).

Note: The whoToSend property takes a comma-separated list of UUIDs for the Environments. It does not accept Environment names.

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 a Bundle

The following example downloads a Bundle for Publishing:

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"
}
'