All articles in iCM are identified by a unique ID. When using iCM_obj_articleUpdate, if the supplied ArticleID already exists, that article will be updated. If the ArticleID is blank (or set as zero) a new article will be created.
When creating a new article, you can either provide the ArticleStruct, or use iCM_obj_articleGet with ArticleTemplateID to return an empty ArticleStruct which you will then have to merge with your new article data.
ArticleStruct.ArticleID, ArticleStruct.ArticleHeading, ArticleStruct.ArticleParentID and ArticleStruct.ArticleTemplateID must be set. Other elements must be provided, but if left blank will assume sensible defaults.
Both the username and password should be provided using the default credentials of an API Key. See "Supplying Default Credentials" in URLs, Keys and Authentication.
Properties
Name | Type | Description |
---|---|---|
CSUserName | String, required | The username of the iCM user inserting/updating the article. This should be provided using the default credentials of an API Key |
CSUserPassword | String, required | The password of the iCM user inserting/updating the article. This should be provided using the default credentials of an API Key |
SignificantChange | Boolean, optional | Whether or not this update should be flagged as a significant change |
VersionNotes | String, optional | Notes added to the article version history when this update is made. There's a maximum length of 256 characters |
ArticleStruct | Object, required | See below |
Required ArticleStruct Properties
The following properties must be defined in the ArticleStruct object. Those marked as required must have a value. Others are required, but their values may be an empty string.
Name | Type | Description |
---|---|---|
ArticleDate | DateTime | The creation date and time of the article. This will always be "now" but needs to be supplied as an empty string |
ArticleID | Integer, Required | The ID of the article to be updated. Set as 0 to create a new article |
ArticleHeading | String, Required | The article's heading text |
ArticleTemplateID | Integer, Required | The ID of the template the article will use |
ArticleParentID | Integer, Required | The article ID beneath which the article will be created/updated |
ArticleIntroText | String | The article introductory text |
ArticleDisplay | String | Either "on" or "off". Defaults to "on" (the article is visible on the site) |
ArticleDisplayDate | DateTime | The date and time from which the article will display. Defaults to the article create date/time if left blank. Dates in an ISO 8601 combined format, ie "2018-02-01T00:00:00Z" |
ArticleDisplayEDate | DateTime | The date and time until which the article will display. Defaults to 100 years in the future if left blank. Dates in an ISO 8601 combined format, ie "2018-02-01T00:00:00Z" |
Archiveable | Boolean | If true the article will be archived on the ArchiveDate. Defaults to false |
ArchiveDate | DateTime, Required if Archiveable:true | The date on which the article will be archived. Dates in an ISO 8601 combined format, ie "2018-02-01T00:00:00Z" |
ArchiveParentID | Integer, Required if Archiveable:true | The parent beneath which the article will move on its archive date |
ArticleText | String | The article body text. HTML will be tidied, and unsupported HTML elements removed, following the standard behaviour of the article editor described in Text Editor Configuration |
ArticleReviewDate | DateTime | The date and time on which the article update is due (whether explicitly set or calculated form the ReviewInterval). Leave blank for no review. Dates in an ISO 8601 combined format, ie "2018-02-01T00:00:00Z" |
ArticleReviewInterval | String | The number of hours between reviews. Leave blank for no review |
Optional ArticleStruct Properties
All of the following properties can be optionally included in the ArticleStruct object.
Name | Type | Description |
---|---|---|
ArticleSummary | String | The article summary text |
ArticleTextAdditional | Object | Additional text blocks, other than the body text, are returned as an object in the format {"BLOCKID": "<p>Text</p>"} |
BoostedKeywords | String | A comma separated list of the article's boosted keywords |
BoostValue | Integer | The search boost value, -10 to +10 |
ChildArticleIDs | String | A comma separated list of child article IDs. If manual ordering of articles is enabled this property can be used to reorder the child articles. Otherwise ignored |
Extension | Object | The article's extension data. This MUST be supplied if the article's template specifies extension data |
FriendlyURL | String | The article's friendly URL |
LocationIndex | Integer | The ordering position where this article will be inserted within its siblings below the parent article if manual of articles is enabled. Otherwise ignored |
OwnerID | Integer | The ID of an iCM user to set as the article owner. Defaults to the ID of the user creating the article (ie the user provided by the API Key) |
UpdateNotes | String | Notes visible on the article schedule tab and included in the update due email if ArticleReviewDate or ArticleReviewInterval have been set |
SecureUserList | String | A comma separated list of site user group IDs this article should be secured to |
RelatedMediaList | String | A comma separated list of content IDs to relate to this article |
RelatedLinkList | String | A comma separated list of content IDs to relate to this article |
RelatedMetaDataList | String | A comma separated list of content IDs to relate to this article |
RelatedArticleList | String | A comma separated list of content IDs to relate to this article |
RelatedPollList | String | A comma separated list of content IDs to relate to this article |
RelatedForumList | String | A comma separated list of content IDs to relate to this article |
RelatedFeatureList | String | A comma separated list of content IDs to relate to this article |
RelatedRackList | String | A comma separated list of content IDs to relate to this article |
RelatedProductList | String | A comma separated list of content IDs to relate to this article |
RelatedEventList | String | A comma separated list of content IDs to relate to this article |
RelatedFormList | String | A comma separated list of content IDs to relate to this article |
Returns
If the request was successful the result data object will contain an object called CONTENT which includes the article ID and another called STATE indicating the article was created/updated successfully.
{
"id": 106,
"result": {
"CONTENT": {
"Status": "Live",
"ArticleID": 3424
},
"STATE": {
"Status": "ACCESS GRANTED"
}
},
"jsonrpc": "2.0"
}
Example 1
In this example the core properties are provided in the ArticleStruct. ArticleID is 0 because we are creating a new article. Setting the ArticleID of an existing article would update that article. As with all iCM_ requests, the parameters are provided in the "attributes" object and the user details by the apiKey.
Make a call to iCM_obj_articleGet with the desired ArticleTemplateID to return a default structure for that template type.
function(params, credentials) {
let createArticle = this.callWorkerMethod("icmapi", "iCM_obj_articleUpdate", {
"attributes": {
"ArticleStruct": {
"ArticleDate": "",
"ArticleID": 0,
"ArticleHeading": "My New Article",
"ArticleTemplateID": 1,
"ArticleParentID": 3424,
"ArticleIntroText": "",
"ArticleDisplay": "",
"ArticleDisplayDate": "",
"ArticleDisplayEDate": "",
"Archiveable": "",
"ArchiveDate": "",
"ArchiveParentID": "",
"ArticleText": "",
"ArticleReviewDate": "",
"ArticleReviewInterval": ""
}
}
}, {
"options": {
"apiKey": "<Your API Key>"
}
});
return createArticle;
}
Example 2
When updating an existing article you can either supply the ArticleStruct as in example 1, or call iCM_obj_articleGet and an ArticleID to return the content of an existing article.
In this example we are fetching article ID 25 and updating its heading text.
function(params, credentials) {
let articleData = this.callWorkerMethod("icmapi", "iCM_obj_articleGet", {
"attributes": {
"ArticleID": 25,
"GetExtensionData": true
}
});
articleData.CONTENT.ArticleHeading = "Here's my new heading";
let createArticle = this.callWorkerMethod("icmapi", "iCM_obj_articleUpdate", {
"attributes": {
"ArticleStruct": articleData.CONTENT
}
}, {
"options": {
"apiKey": "<Your API Key>"
}
});
return createArticle;
}