Toggle menu

CSMedia

The CSMedia class handles the querying of an iCM media item.

The CSMedia class includes methods for the retrieval of a particular media item's details. All such methods require that certain database and key information (MediaID for example) be specified via the properties provided, prior to their invocation.

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

Methods

Parameters must use the get-set structure described in the introduction - Java API (CSObjects).

  • get a string (comma separated) that lists the properties whose values should be returned, an asterisk to indicate that all properties should be returned, or an empty string to return nothing
  • set the properties which should be set before the specified method is performed

CSMedia_get

Retrieves the details of a media item. A secure media item will return a CSSecurityException if no UserID is set with the request. A CSSecurityException will also be thrown if a UserID is supplied that doesn't have access to the media item. For performance reasons, do not supply a UserID if the items you are interested in are not secure. Performance can be improved by providing the GroupList alongside the UserID, if known. Security can be overridden using OverrideSecurity.

Request Parameters

NameTypeDescription
getStringA comma separated list of properties to return
set.MediaIDIntegerRequired. The ID of the media item you'd like to get

In this request we want to know the media item's title, type and any components.

{
    "get": "",
    "set": {
        "MediaID": 2020
    }
}

Response

NameTypeDescription
data.itemDataObjectThe properties of the get request

"result": {
    "data": {
        "itemData": {}
    },
    "success": true
}

Example

Request:

function(params, credentials) {
    var getMedia = this.callWorkerMethod("icmapi", "CSMedia_get", {
        "get": "Title,Type",
        "set": {
            "MediaID": 2020
        }
    });
    return getMedia;
}

Response:

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

{
    "id": 115,
    "result": {
        "Type": "image",
        "_ItemClass": "CSMedia",
        "Title": "GOSS Logo 2022"
    },
    "jsonrpc": "2.0"
}

Properties

PropertyTypeDescription
ArticleIDIntegerThe ID of an article this media item links to
BoostedKeywordsStringAlthough present, this property is not used
BoostValueIntegerThe search boost value for this media item. Currently always 1 as this property is not used
CreationDateDateTimeThe date and time this media item was created, for example "2018-01-12T10:29:59Z"
DescriptionStringThe description of the media item
DetailLevelStringThe level of detail returned. One of:
1 - LEVEL_ID: MediaID only
2 - LEVEL_SUMMARY: MediaID, Title, Description, Keywords, ArticleID, LinkID, TypeID, Type, GroupID and GroupName
3 - LEVEL_DETAIL: The summary information plus the CreationDate, StartDate, EndDate, LastModifiedDate, Display and review details
4 - LEVEL_ALL: All of the above, plus the FileArray
5 - LEVEL_ALL_PLUS_RELATED: All of the above, plus RelatedMetaDataIDs
The default level is 4
DirectoryStringDeprecated. Holds the same value as Type
DisplayBooleanIf true the media item is visible on the site
EndDateDateTimeThe date and time this media item will stop being displayed, for example "2018-01-12T10:29:59Z"
FileArrayArrayAn array of CSMediaContentFile objects. See below
GroupIDIntegerThe ID of the group this media item is in
GroupListStringA comma separated list of user groups. Used in conjunction with UserID
GroupNameStringThe name of the group this media item is in
KeywordsStringKeywords added to this media item
LastModifiedDateDateTimeThe date and time on which this media item was last modified, for example "2018-01-12T10:29:59Z"
LinkIDIntegerThe ID of an external link this media item links to
LinkTextStringAlways null
MediaDirectoryStringThe absolute path to the media directory
MediaIDIntegerThe ID of the media item
MediaPathArrayAn array of group IDs this item is in. 0 is the root media group
ModUserIDIntegerThe ID of the last user to edit this item
OverrideSecurityBooleanIf true, media details (minus the file details) will be returned even if security checks fail
OverrideSecurityFilesBooleanIf true, media details including the file details will be returned even if security checks fail
OwnerIDIntegerThe ID of the user who owns this media item
OwnerTypeStringThe type of the media item owner (will always be User)
RelatedMetaDataIDsStringA comma separated list of metadata IDs related to this media item
ReviewableBooleanWhether this media item has a review date/interval or not
ReviewDateDateTimeThe date and time on which the media item update is due (whether explicitly set or calculated form the ReviewInterval), for example "2018-01-12T10:29:59Z"
ReviewIntervalIntegerThe number of hours between reviews
StartDateDateTimeThe date and time this media item will start being displayed, for example "2018-01-12T10:29:59Z"
TitleStringThe title of the media item
TypeStringThe media item's type (ie a type definition)
TypeIDIntegerThe ID of the media type
UserIDIntegerSpecifying UserID in combination with MediaID will will only return the requested media item's details if the user passes any security set on the media item. If the media item is not secure, this has no effect. If the media item is secure and the UserID does not have access, a security exception is thrown.

Performance can be improved by also supplying the list of the website user group IDs to which the specified user belongs. To improve performance, do not set UserID if you are only interested in retrieving unsecured media

{
    "_ItemClass": "CSMedia",
    "ArticleID": 0,
    "BoostedKeywords": "",
    "BoostValue": 1,
    "CreationDate": "2022-01-18T16:28:30Z",
    "Description": "GOSS Logo",
    "DetailLevel": 4,
    "Directory": "image",
    "Display": true,
    "EndDate": "2122-01-18T16:27:20Z",
    "FileArray": [{
        "FilePath": "r/2/gossdocsDEVlogo_1oiz78e1o3riq.png",
        "_ItemClass": "CSMediaContentFile",
        "FileType": "image",
        "FileName": "r/2/gossdocsDEVlogo_1oiz78e1o3riq.png"
    }, {
        "FilePath": "r/2/gossdocsDEVlogo.png",
        "_ItemClass": "CSMediaContentFile",
        "FileType": "thumbnail",
        "FileName": "r/2/gossdocsDEVlogo.png"
    }],
    "GroupID": 180,
    "GroupList": "",
    "GroupName": "System - Icons and Logos",
    "Keywords": "",
    "LastModifiedDate": "2022-06-28T09:55:39Z",
    "LinkID": 0,
    "LinkText": null,
    "MediaDirectory": "",
    "MediaID": 5703,
    "MediaPath": ["180", "0"],
    "ModUserID": 57,
    "OverrideSecurity": false,
    "OverrideSecurityFiles": false,
    "OwnerID": 57,
    "OwnerType": "User",
    "RelatedMetaDataIDs": "",
    "Reviewable": false,
    "ReviewDate": null,
    "ReviewInterval": 0,
    "StartDate": "2022-01-18T16:27:20Z",
    "Title": "GOSS Logo 2022",
    "Type": "image",
    "TypeID": 1,
    "UserID": 0
}

File Arrays

Each media item in iCM can be made up of a number of "components", seen most often with image media items where different sizes, ratios and resolutions of an image may be defined.

The FileArray list is populated with CSMediaContentFile objects, each of which represents a file/component of the media item. For example, this media item has two components, one called "Image" and one called "Thumbnail":

"FileArray": [{
    "FilePath": "s/h/AP109K-girl-shouting-books.jpg",
    "_ItemClass": "CSMediaContentFile",
    "FileType": "Image",
    "FileName": "s/h/AP109K-girl-shouting-books.jpg"
}, {
    "FilePath": "s/k/AP109K-girl-shouting-books.jpg",
    "_ItemClass": "CSMediaContentFile",
    "FileType": "Thumbnail",
    "FileName": "s/k/AP109K-girl-shouting-books.jpg"
}]

Last modified on October 27, 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon