NewsItem
Last updated
Last updated
News item manipulation methods
Save news item. Triggers a validation of the news item.
Replace the NewsML source. Will effectively replace the current article with anything in the incoming NewsML.
Deprecated
Use api.newsItem.replaceSource()
instead
string
| null
Return the GUID in the NewsItemArticle Can return null if no GUID is found in NewsItem
Set news item guid (uuid)
string
Gets locale from article's idf-element. Formatted with underscore, eg. sv_SE, en_GB, nl_NL. Uses fallback languages if the article's language only uses two characters. If fallback fails, will return the configured "language"-property from writer-config.
Object
Gets a language parts object parsed from article's NewsML.
Sets xml:lang property on article's idf-element. Language code should be two two-character codes separated by a dash, eg. sv-SE, en-GB
Object
Get news priority.
Returns: Object
- News priority object in JXON format
Create and insert a new newsPriority object into the news item content meta data. Triggers a documentChanged event to all documentChanged listeners except the plugin making the change.
Set news priority.
object
Get main channel (channel with attribute why="imext:main")
Array
| *
Get Sections. Finds all the service nodes with a qCode containing imsection:
Renames @qcode to qcode so plugins doesn't have to handle
*
Get Section.
Find section on article if any. If no section null is returned. Note that by using this function it is presumed that there can be max one section on an article.
Array
Get Channels Finds all the service nodes with a qCode containing imchn:
Renames @qcode to qcode so plugins doesn't have to handle
Update Section. Removes existing section and add new. Note expects article to only allow one section.
Throws:
Error
Removes .
Throws:
Error
Add a channel as a . Renaming qcode to @qcode.
Throws:
Error
Removes .
Throws:
Error
Object
Get the pubStatus of document
Returns: Object
- Return object with current pubStatus of document
Set pubStatus Creates a pubStatus node in itemMeta if it not exists
object
Get pubStart
Returns: object
- Object {value: "2016-02-08T20:37:25 01:00", type: "imext:pubstart"}
Set pubStart
Remove the node for the pubStart
object
Get pubStop
Set pubStop.
Remove the node for pubStop.
String
Get editorial note from edNote element in itemMeta section.
Set editorial note content in edNote element in itemMeta section
Throws:
Error
*
Get Newspilot article id (if any).
*
Get all author links in itemMeta links
Get IMID organisation and unit(s)
Get IM
Remove an author from newsItem.
Throws:
NotFoundError
When no node is found by provided UUID the NotFoundError is thrown
Add an known author with a specified uuid to the newsItem
Add an simple/unknown author to the newsItem
Updates itemMeta > links > link[type="x-im/author"]/@name for specified uuid.
If parameter author object contains any of
firstName
lastName
phone
facebookUrl
twitterUrl
shortDescription
longDescription a child element, 'data', will be created and a child element to that element with the name of object field will be created, e.g. data > phone.
Note that an existing 'data' element will be removed from link.
Update existing concept link with new data
Recursive function that will add a concepts Broader relations as links in the existing concept link
Update a concept links data node
Attach link with related-geo data to article meta
Remove an author from newsItem
Throws:
NotFoundError
When no node is found by provided authorName the NotFoundError is thrown
*
Generic method to retrieve links with a certain type from the itemMeta section
*
Get tags (link elements from the itemMeta section)
Returns: *
- Return array of tags in JSON or null if no links was found
Example:: { rel: "subject", title: "Dalarna", type: "x-im/category", uuid: "03d22994-91e4-11e5-8994-feff819cdc9f" }
Adds a tag to itemMeta > links section in newsItem
The format used is identical to the search response provided by concepts backend
Update a tag in itemMeta > links section
Throws:
NotFoundError
When no node is found by provided UUID the NotFoundError is thrown
Removes a link in itemMeta links by providing an UUID
Removes a link in itemMeta links by providing an URI
Removes all links in itemMeta links by providing a type
Remove a link from itemMeta links section by type and rel attributes
Remove a link from contentMeta links section by type and rel attributes
Removes links from contentMeta links section that matches provided filter and type.
The filter function is called for each link mathing the type. If the filter returns 'true', the link is removed.
Adds a new x-im/place link into itemMeta links
Update a location
Throws:
Error
array
Get all location with link type x-im/place, x-im/polygon or x-im/position with the specified entity
Returns: array
- {"data":{"position":"POINT(16.570516 56.774485)"},"rel":"subject","title":"Rälla","type":"x-im/place","uuid":"6599923a-d626-11e5-ab30-625662870761"}
Adds a link to itemMeta links section
Updates the rel value on a meta link
Adds a link to contentMeta links section
array
Retrieve links from itemMeta section by specified type and rel
Returns: array
- Array of links
array
Retrieve links from itemMeta section by specified type
Returns: array
- Return array of links transformed to JSON
array
Get links in contentMeta links section by specified type
Returns: array
- Return array of links transformed to JSON
array
Get stories
Returns: array
- Array of stories found
array
Get concept sections
Returns: array
- Array of concept sections
Add a story link to itemMeta links section
Updates title on existing story
Throws:
NotFoundError
Deprecated
Adds a content-profile link to NewsItem
Adds a content-profile link to NewsItem
Adds a category link to NewsItem
Deprecated
Use updateContentProfile instead.
Updates title on existing story
array
| null
Returns a list of all existing content-profiles in NewsItem
object
| null
Returns a conceptItem with matching UUID
Returns: object
| null
- ConceptItem or null
array
| null
Returns a list of all existing categories in NewsItem
String
Get the sub-type of the article (if there is one) For regular stories/articles this will return an empty string Other types includes: x-im/print, x-im/fact etc
Returns: String
- Subtype or empty string
string
| Element
Retrieve either an itemMetaExtProperty or contentMetaExtProperty value from the item or content meta sections. Optionally return full element if raw parameter is set to true.
Create new or set a value of existing itemMetaExtProperty or contentMetaExtProperty
Delete a specified itemMetaExtProperty or contentMetaExtProperty
*
| null
Returns the generated temporary id for the article. Temporary id is used when a new article is created and before it's saved the first time.
Set a temporaryId for the article
boolean
Checks if current article has a temporary id
string
Get the id for the article
bool
Get value of itemMetaExtProperty element with type imext:haspublihedversion that indicates whether the newsitem has published version or not.
Set itemMetaExtProperty element with type imext:haspublihedversion to true/false in item > meta sections to indicate whether this newsitem has a published version or not.
Array
Retrieve objects from contentmeta.medata section based on type.
Returns: Array
- Array of objects in jxon format
Object
Retrieve object from contentmeta.medata section based on id.
Returns: Object
- Object in jxon format
Create and add an object into the contentmeta.metadata section. The object is encoded as a jxon object with the mandatory attributes id and type. All data must reside in the sub data structure. If an object with the specified id already exists it is silently replaced. Triggers a document:changed event.
Remove a specific object identied by id from the contentmeta.metadata section. Triggers a document:changed event.
Invalidate document and displays notification that document is invalid
*
Get version created date. Resides in newsItem > itemMeta block. If no version created date was found, null is returned.
*
Get first created date. Resides in newsItem > itemMeta block. If no first created date was found, null is returned.
*
Get content created date. Resides in newsItem > contentMeta block. If no content created date was found, null is returned.
*
Get content modified date. Resides in newsItem > contentMeta block. If no content modified date was found, null is returned.
Param
Type
Default
sourceXml
string
etag
string
null
Param
Type
Description
uuid
string
Required - New uuid or null to clear
Param
Type
Default
Description
name
string
Required - Plugin-id that set language
languageCode
string
Required - Two two-character language-region codes, separated by a dash. eg. sv-SE, en-GB, nl-NL
textDirection
string
"ltr"
Required - 'ltr'
or 'rtl'
Param
Type
name
string
newsPriority
object
Param
Type
Description
name
string
Required - Name of the plugin making the call
newsPriority
Object
Required - News priority object
Param
Description
name
Required - Name of plugin.
section
Required - Section object to set on article.
Param
Type
Description
name
string
Required - Name of plugin.
section
string
Required - Section object to remove.
muteEvent
boolean
Required - Optional. Mute event if set to true, only used internally.
Param
Type
Description
name
string
Required - Name of plugin
channel
string
Required - Name of channel
setAsMainChannel
boolean
Required - Set this channel as main channel
Param
Type
Description
name
string
Required - Name of plugin
channel
string
Required - Name of channel
muteEvent
boolean
Required - Optional. Mute event if set to true, only used internally.
Param
Type
name
string
pubStatus
object
Param
Type
Description
name
string
Required - Plugin name
pubStart
object
Required - Expect object with value property. Type is ignored. Object {value: "2016-02-08T20:37:25 01:00"}
Param
name
Param
Type
name
string
pubStop
object
Param
Type
Description
name
string
Required - Plugin name
Param
Type
Description
content
string
Required - String content of editorial note
Param
Type
Description
name
string
Required - Name of the plugin
uuid
string
Required - The UUID of the author to be deleted
Param
Type
Description
name
string
Required - Plugin name
author
object
Required - Author object with the properties name and uuid
Param
Type
Description
name
string
Required - Plugin name
author
object
Required - Author object with the properties name and uuid
Param
Type
Description
name
string
Required - Plugin name
uuid
string
Required - The uuid for the author in the newsItem
author
object
Required - Object containing name and, optional, fields (see above)
Param
Type
Default
Description
name
string
Required -
conceptObject
object
Required -
propertyMap
object
Required -
triggerDocumentChanged
boolean
true
Required - set to false to suppress document changed event, default is set to true
Param
Type
relation
string
conceptObject
object
conceptNode
object
propertyMap
object
Param
Type
conceptObject
object
conceptNode
object
Param
Type
relatedGeoPolygons
object
Param
Type
Description
name
string
Required - Name of the plugin
authorName
string
Required - The name of the author to be deleted
Param
Type
Description
name
Required - Plugin name
types
array
Required - Types of links to select
subject
string
Required - optional Which kind of subject to select, defaults to "subject"
Param
Description
types
Required - An array of types considered being tags. Example ['x-im/person, x-im/channel']
Param
Type
Description
name
string
Required - The name of the plugin
tag
object
Required - Must containt title, type and uuid
Param
Type
Description
name
string
Required - The name of the plugin
uuid
string
Required - The UUID of the link element
tag
object
Required - The tag, same format as concept backend provides in search {"name": [ "2016 Eurovision Song Contest" ], "type": [ "story" ], "typeCatalog": [ "imnat" ], "imType": [ "x-im/story" ] }
Param
Description
name
Required - The name of the plugin calling the method
uuid
Required - The uuid of the link to be removed
Param
Type
Description
name
string
Required - The name of the plugin calling the method
uri
string
Required - The URI of the link to be removed
Param
Type
Description
name
string
Required - of the plugin calling the method
type
string
Required - of the links to be removed
Param
Type
name
string
uuid
string
rel
string
Param
Type
name
string
type
string
rel
string
Param
Type
Description
name
string
Required - The name of the plugin performing the remove.
type
string
Required - The link type that should be part of removal
filter
function
Required - A function that gets the a link as a argument. Should return 'true' if the link should be removed.
Param
Description
name
Required - Plugin name calling function
location
Required - The location in JSON containing
Param
Type
Description
name
string
Required - Name of plugin
location
object
Required - The location in JSON
Param
Type
Description
entity
string
Required - Optional entity specification, either "all", "position" or "polygon"
Param
Type
Default
Description
name
string
Required - The name of the plugin adding the link
link
object
Required - Uses jxon.unbuild to transform JSON to XML. Make sure to use @ property names for attributes.
triggerDocumentChanged
boolean
true
Required - set to false to suppress document changed event, default is set to true
Param
Type
Description
name
string
Required - The name of the plugin that is triggering the change
link
object
Required - a link object with a valid uuid and valid rel
Param
Type
Description
name
string
Required - The name of the plugin adding the link
link
object
Required - Uses jxon.unbuild to transform JSON to XML. Make sure to use @ property names for attributes.
Param
Type
name
string
type
string
rel
string
Param
Type
Description
name
string
Required - Name of the plugin
type
string
Required - The link type
Param
Type
Description
name
string
Required - Name of the plugin
type
string
Required - The link type
Param
name
story
Param
Type
Description
name
string
Required - Plugin name
story
object
Required - A story object that atleast contains title and uuid
Param
Type
Description
name
string
Required - Name of the plugin
contentprofile
object
Required - A contentprofile object containing uuid and title
Param
Type
Description
name
string
Required - Name of the plugin
contentprofile
object
Required - A contentprofile object containing uuid and title
Param
Type
Description
name
string
Required - Name of the plugin
category
object
Required - A category object containing uuid and title
Param
Type
Description
name
string
Required - Plugin name
contentprofile
object
Required - A concept profile object that atleast contains title and uuid
Param
Type
Default
Description
sectionName
string
Required - Either 'itemMeta' or 'contentMeta'
type
string
Required -
raw
boolean
false
Required - Optional, return as raw dom element, default is false
Param
Type
Description
name
string
Required - Identifier of caller
sectionName
string
Required - Either 'itemMeta' or 'contentMeta'
type
string
Required - Type string
value
string
Required - Value
Param
Type
Description
name
string
Required - Identifier of caller
sectionName
string
Required - Either 'itemMeta' or 'contentMeta'
type
string
Required - Type
Param
temporaryArticleID
Param
Type
Description
name
string
Required - Identifier of caller
value
bool
Required - True or false
Param
Type
Description
objectType
string
Required - The type of object
Param
Type
Description
id
string
Required - The id of object
Param
Type
Description
name
string
Required - Name of the plugin making the call
jxonObject
Object
Required - The jxon encoded object
Param
Type
Description
name
string
Required - Name of the plugin making the call
id
string
Required - The id of the object