Creating Content Items

Content Repository : Developer Guide

Use the Content Item API to create the item

Content items are initialized using the function. A name is the only parameter required to create an item:

item_id := name => 'my_item' );

The name represents the tail of the URL for that content item. In most cases you will want to create items in a particular context with the repository hierarchy:

item_id :=
   name      => 'my_item', 
   parent_id => :parent_id

The parent ID must be another content item, or a subclass of content item such as a folder.

The function accepts a number of other optional parameters. The standard creation_date, creation_user and creation_ip should be specified for auditing purposes. You can also create the initial revision and publish text items in a single step:

item_id :=
   name      => 'my_item', 
   parent_id => :parent_id,
   title     => 'My Item',
   text      => 'Once upon a time Goldilocks crossed the street.  
                 Here comes a car...uh oh!  The End',
   is_live   => 't'

If either the title or text are not null, the function will create the first revision of the item. It will also mark the item as live if the is_live parameter is true. The alternative to this one step method is to create a content item and then add a revision using the Content Revision API.

Publishing a content item

If a content item has at least one revision, then it can be published by calling the content_item.set_live_revision procedure, which takes as input a revision_id:

content_item.set_live_revision( revision_id => :revision_id );

Last Modified: $‌Id: items.html,v 1.2 2017/08/07 23:47:47 gustafn Exp $