Toggle menu

CSObject

The CSObject class handles the querying of an iCM object.

The CSObject class includes methods for the retrieval, update, creation and removal of a particular object's details. All such methods require that certain database and key information (ObjectID for example) be specified via the properties provided, prior to their invocation.

iCM Objects are identified either by their unique ID or their Type and Label used in combination.

As it is possible to relate other CSObjects to a CSObject instance, this class also includes methods for the creation and removal of object relationships. Again, these methods require that certain database and key information be specified via the properties provided, prior to their invocation.

All database access/connectivity is handled internally by the CSObject class.

For a general overview of iCM objects, see Object Types.

Methods

CSObject_delete 

Deletes an iCM object from the database. An object can be identified either by its ID or the combination of its Type and Label.

Any relationships with other objects will also be removed when an object is deleted.

Request Parameters

NameTypeDescription
getStringA comma separated list of properties to return
set.ObjectIDIntegerOptional. The ID of the object to delete
set.LabelStringOptional, required if Type is used. The Label and Type of the object to delete
set.TypeStringOptional, required if Label is used. The Label and Type of the object to delete

{
    "get": "",
    "set": {
        "Label": "858a50a0-55fb-11ed-a457-c3c55c762ada",
        "Type": "EXAMPLE",
        "ObjectID": 19307
    }
}

Response

NameTypeDescription
data.itemDataObjectThe properties of the request, if present

{
    "id": 167,
    "result": {
        "data": {
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

Example

Request:

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObject_delete", {
        "get": "ObjectID,Label,ObjectData,Type",
        "set": {
            "ObjectID": 20068
        },
    });
    return object;
}

Response:

Note that using this.callWorkerMethod in an End Point parses the response, only returning the itemData in the result.

{
    "id": 193,
    "result": {
        "Type": "EXAMPLEHOUSE",
        "_ItemClass": "CSObject",
        "ObjectID": 20068,
        "Label": "FB88D950-55FD-11ED-A457-C3C55C762ADA",
        "ObjectData": {}
    },
    "jsonrpc": "2.0"
}

CSObject_exist

Checks to see whether a particular iCM object or relationship exists in the database.

Request Parameters

NameTypeDescription
getStringSet as an empty string
set.ObjectIDIntegerOptional. The ID of the object
set.LabelStringOptional, required if Type is used
set.TypeStringOptional, required if Label is used

{
    "get": "",
    "set": {
        "Label": "858a50a0-55fb-11ed-a457-c3c55c762ada",
        "Type": "EXAMPLE",
        "ObjectID": 19307
    }
}

Response

The returnValue will be true if the object exists.

{
    "id": 416,
    "result": {
        "data": {
            "returnValue": true,
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

Example

Request:

Note the use of rawMode: true when working with  this.callWorkerMethod  so that the full response can be seen, not just the itemData object.

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObject_exist", {
        "get": "",
        "set": {
            "ObjectID": 20068
        }
    }, {
        "rawMode": true
    });
    return object;
}

Response:

{
    "id": 416,
    "result": {
        "data": {
            "returnValue": true,
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

CSObject_generateXMLDocAsString

Returns a string containing a representation of the object's data as a complete XML document. The file generated has the same format as files generated by iCM's object export function.

Request Parameters

NameTypeDescription
getStringSet as an empty string
set.ObjectIDIntegerOptional. The ID of the object
set.LabelStringOptional, required if Type is used
set.TypeStringOptional, required if Label is used

{
    "get": "",
    "set": {
        "Label": "858a50a0-55fb-11ed-a457-c3c55c762ada",
        "Type": "EXAMPLE",
        "ObjectID": 19307
    }
}

Response

NameTypeDescription
data.itemDataObjectThe properties of the request, if present
data.returnValueStringThe object as a string

"result": {
    "data": {
        "returnValue": "<objects type=\"ANOTHERTYPE\">\r\n<alldata>\r\n<properties>\r\n<lastupdatedon>13-04-2017 09:51:08</lastupdatedon>\r\n<label>EEBADF20-4A89-464F-B642-4C8FEA28EB94</label>\r\n<createdby>UNKNOWN</createdby>\r\n<createdon>13-04-2017 09:25:08</createdon>\r\n<lastupdatedby>UNKNOWN</lastupdatedby>\r\n<objectid>153</objectid>\r\n</properties>\r\n<content>\r\n<anotherproperty>tim@gossinteractive.com</anotherproperty>\r\n</content>\r\n</alldata>\r\n</objects>\r\n",
        "itemData": {}
    },
    "success": true
}

Example

Request:

Note the use of rawMode: true when working with  this.callWorkerMethod  so that the full response can be seen, not just the itemData object.

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObject_generateXMLDocAsString", {
        "get": "ObjectID",
        "set": {
            "ObjectID": 20070
        }
    }, {
        "rawMode": true
    });
    return object;
}

Response:

{
    "id": 183,
    "result": {
        "data": {
            "returnValue": "<objects type=\"EXAMPLEHOUSE\">\n<alldata>\n<properties>\n<lastupdatedon>27-10-2022 14:48:05</lastupdatedon>\n<label>FB88D950-55FD-11ED-A457-C3C55C762ADA</label>\n<createdby>UNKNOWN</createdby>\n<createdon>27-10-2022 14:48:05</createdon>\n<lastupdatedby>UNKNOWN</lastupdatedby>\n<objectid>20070</objectid>\n</properties>\n<content>\n<road>Darklake View</road>\n<number>24</number>\n</content>\n</alldata>\n</objects>\n",
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

CSObject_get

Retrieves the details of an iCM object from the database. Either the ObjectID or Type and Label must be supplied if you want to return an existing object.

Use Type on its own to return an empty object data structure for that Type.

Request Parameters

NameTypeDescription
getStringA comma separated list of properties to return
set.ObjectIDIntegerOptional. The ID of the object
set.LabelStringOptional. The object's label
set.TypeStringOptional, required if Label is used. Set Type on its own to return an empty object structure

{
    "get": "",
    "set": {
        "Label": "858a50a0-55fb-11ed-a457-c3c55c762ada",
        "Type": "EXAMPLE",
        "ObjectID": 19307
    }
}

Response

NameTypeDescription
data.itemDataObjectThe properties of the request

{
    "id": 51,
    "result": {
        "data": {
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

Example

Request:

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObject_get", {
        "get": "ObjectData",
        "set": {
            "ObjectID": 20071
        }
    });
    return object;
}

Response:

Note that using this.callWorkerMethod in an End Point parses the response, only returning the itemData in the result.

{
    "id": 199,
    "result": {
        "_ItemClass": "CSObject",
        "ObjectData": {
            "ROAD": "Darklake View",
            "NUMBER": "24"
        }
    },
    "jsonrpc": "2.0"
}

CSObject_update

Update is used to update an existing, or create a new, object of a defined type. To update an existing object either the ObjectID or Type and Label must be supplied.

To create a new object the Type must already exist and a new unique Label should be supplied.

Request Parameters

NameTypeDescription
getStringA comma separated list of properties to return
set.ObjectDataObjectThe data to store in the object. Must match the properties of the object type definition
set.ObjectIDIntegerOptional. The ID of the object to update
set.LabelStringOptional, required if type is used. Set Label and Type to update the existing object. Set a new Label to create a new object of this Type
set.TypeStringOptional, required if Label is used and match an existing Type
set.UpdatedLabelStringOptional, a new label for an existing object

{
    "get": "",
    "set": {
        "Label": 123456789,
        "Type": "EXAMPLEHOUSE",
        "ObjectData": {
            "NUMBER": 24,
            "ROAD": "Darklake View"
        }
    }
}

Response

NameTypeDescription
data.itemDataObjectThe properties of the request

{
    "id": 51,
    "result": {
        "data": {
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

Example

Request:

In this example we're creating a new object. We already know the stucture of the object data. Note how a new label is being generated.

function(params, credentials) {
    var uuidv1 = require("uuid/v1");
    var object = this.callWorkerMethod("icmapi", "CSObject_update", {
        "get": "ObjectID,Label,ObjectData,Type",
        "set": {
            "Label": uuidv1(),
            "Type": "EXAMPLEHOUSE",
            "ObjectData": {
                "NUMBER": 24,
                "ROAD": "Darklake View"
            },
        },
    });
    return object;
}

Response:

Note that using this.callWorkerMethod in an End Point parses the response, only returning the itemData in the result.

{
    "id": 212,
    "result": {
        "Type": "EXAMPLEHOUSE",
        "_ItemClass": "CSObject",
        "ObjectID": 20075,
        "Label": "a4da32c0-5602-11ed-a457-c3c55c762ada",
        "ObjectData": {
            "NUMBER": 24,
            "ROAD": "Darklake View"
        }
    },
    "jsonrpc": "2.0"
}

Properties

PropertyTypeDescription
CreatedByStringThe username of the user who created this object
DateCreatedDateTimeThe date and time on which this object was created, for example "2018-01-12T10:29:59Z"
DateLastUpdatedDateTimeThe date and time on which this object was last updated, for example "2018-01-12T10:29:59Z"
DetailLevelIntegerThe level of detail returned. Either:
1 - LEVEL_ID Just the Object ID
2 - LEVEL_SUMMARY The ID, Type and Label
3 - LEVEL_DETAIL The ID, Type, Label, DateCreated, DateLastUpdated, CreatedBy and LastUpdatedBy
4 - LEVEL_ALL Everything, including the object's data

Default: 4
LabelStringThe object's label
LastUpdatedByStringThe username of the user who last updated this object
ObjectDataObjectThe object's data with keys that match the object properties defined in iCM
ObjectIDIntegerThe ID of the object
TypeStringThe type of this object
UpdateDataBooleanDefault: false. If true, any new properties that have been added to the type definition since this object was created will be added to the ObjectData when it is retrieved. ObjectData saved in the database will be unaffected until an update call is performed following the retrieval of the UpdateData
UpdatedLabelStringAllows the label of an existing object to be updated (ie the supplied UpdatedLabel will become the new label). As this is a separate property from Label it is possible to update the label of an object identified by label. If the property is set then the update operation will fail if no existing object is found which can be updated
UpdateIndexBooleanDeprecated
UserProfileTypeStringDefault: USERPROFILE. Gets/sets the object type that is used to store user profile information. The type is used to identify insert/update/delete of user profile objects so that, for example, the appropriate gateway messages can be triggered to ensure the site user search index is kept up to date

{
    "_ItemClass": "CSObject",
    "CheckTypeExistsOnCreate": true,
    "CreatedBy": "UNKNOWN",
    "DateCreated": "2022-10-27T14:06:06Z",
    "DateLastUpdated": "2022-10-27T14:06:06Z",
    "DetailLevel": 4,
    "Label": "80114E80-5600-11ED-A457-C3C55C762ADA",
    "LastUpdatedBy": "UNKNOWN",
    "ObjectData": {
        "ROAD": "Darklake View",
        "NUMBER": 24
    },
    "ObjectID": 20071,
    "RelatedDirection": null,
    "RelatedID": 0,
    "RelatedList": "",
    "Type": "EXAMPLEHOUSE",
    "UpdateData": false,
    "UpdatedLabel": null,
    "UserProfileType": "FORM_USERPROFILE"

Last modified on 27 October 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon