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 nothingset 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
Name | Type | Description |
---|---|---|
get | String | A comma separated list of properties to return |
set.MediaID | Integer | Required. 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
Name | Type | Description |
---|---|---|
data.itemData | Object | The 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
{
"id": 115,
"result": {
"Type": "image",
"_ItemClass": "CSMedia",
"Title": "GOSS Logo 2022"
},
"jsonrpc": "2.0"
}
Properties
Property | Type | Description |
---|---|---|
ArticleID | Integer | The ID of an article this media item links to |
BoostedKeywords | String | Although present, this property is not used |
BoostValue | Integer | The search boost value for this media item. Currently always 1 as this property is not used |
CreationDate | DateTime | The date and time this media item was created, for example "2018-01-12T10:29:59Z" |
Description | String | The description of the media item |
DetailLevel | String | The 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 |
Directory | String | Deprecated. Holds the same value as Type |
Display | Boolean | If true the media item is visible on the site |
EndDate | DateTime | The date and time this media item will stop being displayed, for example "2018-01-12T10:29:59Z" |
FileArray | Array | An array of CSMediaContentFile objects. See below |
GroupID | Integer | The ID of the group this media item is in |
GroupList | String | A comma separated list of user groups. Used in conjunction with UserID |
GroupName | String | The name of the group this media item is in |
Keywords | String | Keywords added to this media item |
LastModifiedDate | DateTime | The date and time on which this media item was last modified, for example "2018-01-12T10:29:59Z" |
LinkID | Integer | The ID of an external link this media item links to |
LinkText | String | Always null |
MediaDirectory | String | The absolute path to the media directory |
MediaID | Integer | The ID of the media item |
MediaPath | Array | An array of group IDs this item is in. 0 is the root media group |
ModUserID | Integer | The ID of the last user to edit this item |
OverrideSecurity | Boolean | If true, media details (minus the file details) will be returned even if security checks fail |
OverrideSecurityFiles | Boolean | If true, media details including the file details will be returned even if security checks fail |
OwnerID | Integer | The ID of the user who owns this media item |
OwnerType | String | The type of the media item owner (will always be User) |
RelatedMetaDataIDs | String | A comma separated list of metadata IDs related to this media item |
Reviewable | Boolean | Whether this media item has a review date/interval or not |
ReviewDate | DateTime | The 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" |
ReviewInterval | Integer | The number of hours between reviews |
StartDate | DateTime | The date and time this media item will start being displayed, for example "2018-01-12T10:29:59Z" |
Title | String | The title of the media item |
Type | String | The media item's type (ie a type definition) |
TypeID | Integer | The ID of the media type |
UserID | Integer | Specifying 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"
}]