Extending Server Functionality with Remote APIs: Content Server

Select Code Format(s) to Display     VB    C#    Java

Accessing Content Item Metadata

The PRC Content Server API allows you to access metadata about content items. You can retrieve information about the check in, check out, and publication status of content items. For more information about retrieving the values of content item properties, see Editing Content Items. This page covers the following topics:

Retrieving Content Item Metadata

The IContentItem interface provides access to the following content item metadata:

Metadata
Retrieved Information
Method Name
UUID The object ID of the content item. getUUID
Name The name of the content item getName
URL of editor for content item The URL that points to the location of the content item in Content Server Explorer. You can edit the content item from this location.
Note:
The returned URL is not gatewayed.
getEditorURL
Last-modified date The date that the current content item was last updated (this information might not be available). getLastModifiedDate
Check for last modified date Boolean indicating whether or not a modification date exists; if no such date exists, it returns false. hasLastModifiedDate()
Source Data Entry Template The Data Entry Template from which the content item was created. getDataEntryTemplate
Property value Existence of property value in a content item. hasPorpertyValue
Parent folder The parent folder of the content item. getContainingFolder

Retrieving File Content Item Metadata

Content items can be an objects created from a Data Entry Template, or they can be imported files and images. You create a file content item by uploading documents or an images. The IContentItem interface provides access to the following file content item metadata:

Metadata
Retrieved Information
Method Name
File Name The name of the file content item. getFileName
Image name The name of the image file. getImageName
Image height The pixel height of the image. getImageHeight
Image width The pixel height of the image. getImageWidth

If you cannot see the code snippet you need, reset the language filter at the top of the page.

Java:

...

// After the content item has been checked in, retrieve the file content item.
InputStream retrievedContent = incident.getFilePropertyValue(fileProperty);
String retrievedFileName = contentItem.getFileName(fileProperty);

// After the content item has been checked in,
// retrieve the image, image name, height, and width.
InputStream retrievedImage = contentItem.getImagePropertyValue(imageProperty);
String retrievedImageName = contentItem.getImageName(imageProperty);
int imageWidth = contentItem.getImageWidth(imageProperty);
int imageHeight = contentItem.getImageHeight(imageProperty);

...

C#:

...

// After the content item has been checked in, retrieve the file content item.
Stream retrievedContent = contentItem.GetFilePropertyValue(fileProperty);
String retrievedFileName = contentItem.GetFileName(fileProperty);

// After the content item has been checked in,
// retrieve the image, image name, height, and width.
Stream retrievedImage = contentItem.GetImagePropertyValue(imageProperty);
String retrievedImageName = contentItem.GetImageName(imageProperty);
int imageWidth = contentItem.GetImageWidth(imageProperty);
int imageHeight = contentItem.GetImageHeight(imageProperty);

...

VB:

...

' After the content item has been checked in, retrieve the file content item.
Dim retrievedContent As Stream = contentItem.GetFilePropertyValue(fileProperty)
Dim retrievedFileName As String = contentItem.GetFileName(fileProperty)

' After the content item has been checked in,
' retrieve the image, image name, height, and width.
Dim retrievedImage As Stream = contentItem.GetImagePropertyValue(imageProperty)
Dim retrievedImageName As String = contentItem.GetImageName(imageProperty)
Dim imageWidth As Integer = contentItem.GetImageWidth(imageProperty)
Dim imageHeight As Integer = contentItem.GetImageHeight(imageProperty)

...

 

Retrieving Check-In and Check-out Information

The IContentItem interface provides access to the following check in and check out information of a content item:

Information
Retrieved Information
Method Name
Status Boolean indicating whether or not the item is currently checked out. isCheckedOut
Check-in date The latest date the content item was checked in. getLastCheckedInDate
Check for last check in date Boolean indicating whether or not a check-in date exists; if no such date exists, it returns false. hasLastCheckedInDate
Latest version number The latest version number of the content item. Content items that have never been checked out and checked back in will have version number "1." Once the content items have been checked out and checked back in, their version numbers will be incremented to version number "2". getLatestVersionNumber
Latest version comment The latest comment written about a checked-in version of a content item. getLastCheckedInVersionComment
User The ID of the user currently has the content item checked out. If the content item has not been checked out, invoking this method results in an exception. To determine whether a content item has been checked out, call the isCheckedOut method. getCheckedOutUserID

Retrieving Publication Information

The IContentItem interface provides access to the following publication information about a content item:

Information
Retrieved Information
Method Name
Status Boolean indicating whether or not the content item has been published. isPublished
Last published date The date when the content item was last published, in other words, the most recent time when the content item was created on the published target. getLastPublishedDate
Check for last published date Boolean indicating whether or not a publication date exists; if no such date exists, it returns false. hasLastPublishedDate
Last publisher The ID of the user who last published the content item. If the content item has not yet been published, calling this method results in an exception. To determine whether a content item has been published, call the isPublished method. getLastPublishedUserID
Preview URL The URL where the content item can be previewed. The preview URL is valid only if theIContentManager.previewContentItem method has been called prior to the invocation of this method. getPreviewURL
Publication URL The URL where the content item is published. The publication URL is valid only if the IContentManager.publishContentItem method has been called prior to the invocation of this method. getPublishURL

Retrieving Content Item Status

The IContentItem interface provides the following status information of content items:

Metadata
Retrieved Information
Method Name
Checkout status Boolean indicating whether or not the content item is currently in the checked-out state. isCheckedOut
Expiration status Boolean indicating whether or not the content item has been expired. isExpired
Publishable status

Boolean indicating whether or not the content item can be published. A content item is publishable if all the following conditions are met:

  1. The content item has been persisted.
  2. The content item is checked out.
  3. A Presentation Template is attached to the Data Entry Template from which the content item was created.
  4. The user who is publishing the content item has an Editor or higher role.

If one or more of these conditions are not met, the method returns false.

isPublishable
Publication status Boolean indicating whether or not the content item has been published. isCurrentlyPublished

 

Next: Previewing and Publishing Content Items