Toggle menu

Java API (CSObjects)

The CSObjects library includes all of the functionality available in the currently published Java API, with the exception of form rendering (which is provided by the Forms Service worker).

When invoking the iCM API Worker using the apiclient library, the method called will be the CSObjects class, with the method of that class appended to it with an underscore. For example, to invoke the CSArticle get method, use CSArticle_get.

The parameters map supplied to the method call should contain two sub-keys:

  • set the properties (and their values) which should be set before the specified method is performed.
  • get a string that lists the properties whose values should be returned, or alternatively an asterisk to indicate that all properties should be returned.

Standard Methods

The following request retrieves just the article heading for article ID 1.

function(params, credentials) {
    let getArticle = this.callWorkerMethod("icmapi", "CSArticle_get", {
        "get": "ArticleHeading",
        "set": {
            "ArticleID": 1
        }
    });
    return getArticle;
}

Note the use of serverid: this.serverid to call a worker with an internal key.

Non-Standard Methods

When calling a method that is not one of the standard operations (get, update, exist, delete), the iCM API worker first creates an API object and populates it with the contents of the set element of the request and then performs a get. This means that the operation method can be invoked on a populated object.

Any arguments to the non-standard method should be provided by an additional args sub-key (an array) in the parameters map. For example, the following request exports a specific object as an XML string - the argument to generateXMLDocAsString indicates that only objects of type INFO should be included in the response

function(params, credentials) {
    let result = this.callWorkerMethod("icmapi", "CSObjectMultiple_generateXMLDocAsString", {
        "get": "",
        "set": {
            "ObjectList": 1
        },
        "args": ["INFO"]
    });
    return result;
}

iCM API Javadoc

Full documentation for every class in the Java CSObjects API.

Examples

These examples show some of the more common requests to the API and include working with articles, objects, media and users.

Share this page

Facebook icon Twitter icon email icon

Print

print icon