IBM Web Content Manager, programmatically using content as a service.

Similar documents
Customizing Quickr Places

Creating Maps with Google Static API and IBM Web Content Manager

Portal Cache Tuning with Portal Cache Viewer Open Mic 10/01/2014

,

"Charting the Course... WebSphere Portal 8 Development using Rational Application Developer 8.5. Course Summary

A Guide to Liv-ex Software Development Kit (SDK)

Script Portlet Installation and Configuration with Websphere Portal v8.5. Adinarayana H

WCI Feed Service Servlet

Prosphero Intranet Sample Websphere Portal / Lotus Web Content Management 6.1.5

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 1

C exam IBM C IBM Digital Experience 8.5 Fundamentals

Jquery Ajax Json Php Mysql Data Entry Example

Building Rich, OmniChannel Digital Experiences for Enterprise, Social and Storefront Commerce Data with Digital Data Connector

Using AJAX to Easily Integrate Rich Media Elements

Comprehensive AngularJS Programming (5 Days)

XPages development practices: developing a common Tree View Cust...

Static Webpage Development

Advanced Topics in WebSphere Portal Development Graham Harper Application Architect IBM Software Services for Collaboration

New Face of z/os Communications Server: V2R1 Configuration Assistant

Lotus Exam IBM Websphere Portal 6.1 Application Development Version: 5.0 [ Total Questions: 150 ]


Enriching Portal user experience using Dojo toolkit support in IBM Rational Application Developer v8 for IBM WebSphere Portal

The Structure of the Web. Jim and Matthew

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance.

20486-Developing ASP.NET MVC 4 Web Applications

The anatomy of Content Template Catalog v4: how to create custom CTC websites. David Strachan IBM

RailsConf Europe 2008 Juggernaut Realtime Rails. Alex MacCaw and Stuart Eccles

IBM Workplace Web Content Management and Why Every Company Needs It. Sunny Wan Technical Sales Specialist

IT Certification Exams Provider! Weofferfreeupdateserviceforoneyear! h ps://

HTML Advanced Portlets. Your Guides: Ben Rimmasch, Rahul Agrawal

IBM C IBM WebSphere Portal 8.0 Solution Development. Download Full version :

BEAWebLogic. Portal. Overview

JavaServer Faces Technology, AJAX, and Portlets: It s Easy if You Know How!

AngularJS Fundamentals

Using Development Tools to Examine Webpages

IBM Lotus Web Content Management Rendering Portlet Documentation:

Adobe Marketing Cloud Best Practices Implementing Adobe Target using Dynamic Tag Management


Senior Technical Specialist, IBM. Charles Price (Primary) Advisory Software Engineer, IBM. Matthias Falkenberg DX Development Team Lead, IBM

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Joomla

Introduction Haim Michael. All Rights Reserved.

PROCE55 Mobile: Web API App. Web API.

Oracle APEX 18.1 New Features

Tutorials Php Y Jquery Mysql Database Without Refreshing Code

Building JSR-286 portlets using AngularJS and IBM Web Experience Factory

20489: Developing Microsoft SharePoint Server 2013 Advanced Solutions

Web Software Model CS 4640 Programming Languages for Web Applications

ASSIGNMENT #3: CLIENT-SIDE INTERACTIVITY WITH JAVASCRIPT AND AJAX

IBM Forms Experience Builder

The 60-Minute Guide to Development Tools for IBM Lotus Domino, IBM WebSphere Portal, and IBM Workplace Applications

Helpline No WhatsApp No.:

Course Details. Skills Gained. Who Can Benefit. Prerequisites. View Online URL:

Rating WCM content Marwa Arafa

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

footer, header, nav, section. search. ! Better Accessibility.! Cleaner Code. ! Smarter Storage.! Better Interactions.

ThingLink User Guide. Andy Chen Eric Ouyang Giovanni Tenorio Ashton Yon

Simple AngularJS thanks to Best Practices

ORACLE WCM 11G MASTER CLASS

IN PRACTICE. Daniele Bochicchio Stefano Mostarda Marco De Sanctis. Includes 106 practical techniques MANNING

Sparrow Client (Front-end) API

Web 2.0, AJAX and RIAs

Unified Task List. IBM WebSphere Portal V7.0 Review the hardware and software requirements Review the product documentation

IBM Exam C Developing Enterprise Mobile Applications with IBM Worklight and IBM WebSphere Portal Version: 6.0 [ Total Questions: 122 ]

A Closer Look at XPages in IBM Lotus Domino Designer 8.5 Ray Chan Advisory I/T Specialist Lotus, IBM Software Group

KonaKart Shopping Widgets. 3rd January DS Data Systems (UK) Ltd., 9 Little Meadow Loughton, Milton Keynes Bucks MK5 8EH UK

Working with Lotus Web Content Management Web Content Integrator and Problem Determination

Convert Manuals To Html Formatted Text Javascript

20480B - Version: 1. Programming in HTML5 with JavaScript and CSS3

grabattention The jquery Plug-in

AD105 Introduction to Application Development for the IBM Workplace Managed Client

OU Mashup V2. Display Page

What s New IBM Multi-Channel Feature Pack 2 for IBM Web Experience Factory 8.0.x IBM Corporation

AJAX: Rich Internet Applications

Microsoft SharePoint Designer 2010

WebCenter Interaction 10gR3 Overview

Programming Fundamentals of Web Applications

IBM LOT-911. IBM WebSphere Portal 8.0 Solution Development.

Dojo: An Accessible JavaScript Toolkit

Export to excel in javascript without activex. Export to excel in javascript without activex.zip

20486: Developing ASP.NET MVC 4 Web Applications

ENRICHING PRIMO RECORDS WITH INFORMATION FROM WORDPRESS. Karsten Kryger Hansen Aalborg University Library

User Interaction: jquery

The Great SharePoint 2016/2013 Adventure for Developers

Qiufeng Zhu Advanced User Interface Spring 2017

So we broke all CSPs. You won't guess what happened next!

Client-side Debugging. Gary Bettencourt

Get in Touch Module 1 - Core PHP XHTML

IBM Exam C IBM Digital Experience 8.5 Fundamentals Version: 6.0 [ Total Questions: 64 ]

Client Side JavaScript and AJAX

Revision for Grade 7 ASP in Unit :1&2 Design & Technology Subject

IT Certification Exams Provider! Weofferfreeupdateserviceforoneyear! h ps://

Web II CE 2413C 01 CE 2414N 01 Spring 2013

Brief Intro to Firebug Sukwon Oh CSC309, Summer 2015

SHAREPOINT DEVELOPMENT FOR 2016/2013

Manual Html A Href Onclick Submit Form

55249: Developing with the SharePoint Framework Duration: 05 days

Developing Web Applications for Smartphones with IBM WebSphere Portlet Factory 7.0

Lightning Conductor Web Part 2013 Manual 2 Last update: October 24, 2014 Lightning Tools

Database Driven Web 2.0 for the Enterprise

Programming in HTML5 with JavaScript and CSS3

Transcription:

Introduction 1 IBM Web Content Manager, programmatically using content as a service. Table of Contents Table of Contents... 1 Introduction... 1 Prerequisites... 3 IBM Web Content Manager... 3 IBM Script Portlet application... 3 Optional... 3 AJAX with Web Content Manager Standard Menu... 4 AJAX with explicit JSON payload management... 6 Web Content Manager REST API... 8 Content as a Service (Caas)... 11 Appendix... 12 Authors... 12 Introduction IBM Web Content Manager (WCM) provides a rich content experience for producing, managing and displaying web content. Requirements can often be met using the core product capabilities and typically very little coding, however a full web API is available for addressing more repetitive tasks or complex situations. This article and associated sample package (SampleWCMAPI.paa) has been put together to show and describe how IBM Web Content Manager can be used programmatically for fetching and displaying content using commonly available programming techniques. Programmatic approaches to using web content can often be found in mobile based applications and single page websites/applications, these samples help you understand how to use WCM in these use cases. The samples show how WCM can be used in single page applications (SPA) where WCM can generate the list of links and the content itself. The first sample shows a standard WCM menu generating links which are then used to update the content programmatically and without a page refresh.

Introduction 2 The second example shows using a WCM menu which generates JSON, which is then used to produce the list of links and again the content is updated in the same way. The content item in these first two samples is retrieved via the Connect servlet directly. The final sample doesn't use any WCM components, just the WCM REST API. This can be used to create a query for the content and then fetch the content itself. When retrieving content using the WCM REST API it just returns the data and doesn't render the content. So additional calls may be needed to for example if the element is a component reference.

Prerequisites 3 Prerequisites In order to install and take advantage of the samples you will need to have the following software installed. IBM Web Content Manager v8.x. For installation steps please refer to the official documentation instructions, a trial version is also available from here: https://ibm.biz/bdebzn IBM Script Portlet application, see Appendix Where the explicitly stated, IBM WebSphere Portal v8.5 CF05 is required. This is predominantly for the new Content as a Service (CaaS) capability introduced in v8.5 CF05 during March 2015. Optional Developing with JSON can be made simpler through the use of developer debugger plugins. Several plugins are available and in the development of these samples the RESTClient for Firefox and Postman for Google Chrome have proven to be very useful. Postman - https://chrome.google.com/webstore/detail/postman-restclient/fdmmgilgnpjigdojojpjoooidkmcomcm RESTClient - https://addons.mozilla.org/en-us/firefox/addon/restclient/

AJAX with Web Content Manager Standard Menu 4 AJAX with Web Content Manager Standard Menu The first sample shows how to use a menu to generate a list of items and then using jquery programmatically get and set the content without doing a page refresh (the same approach could be taken using the framework of your choice). A standard WCM menu is used to generate the links which then trigger an XHR to get the content as JSON. The content is then dynamically added to the page. This sample is setup by calling the Container HTML component from the Web Content Viewer application, the container component includes: jquery JavaScript library CSS styling for positioning the results getcontent javascript function WCM menu for the content results Figure 1 Sample 1, component relationship. WCM uses Menu components to return content based upon a user defined configuration. In this situation the EventMenu menu component returns all nested content items that are using: Authoring Templates = /SPA/Event Location = /SPA/SPA Demo The menu returns mark-up in the form of an unordered list <ul>. Each lineitem <li> formatted to return the path to the content item (sitepath) and the content items name (title). The a href is wrapped with a call to the javascript function getcontent. Example, SPA/SPA+Demo/Exceptional+Digital+Expereinece+Conference The getcontent function is called each time a content item is clicked, requesting through an $.ajax (jquery) call GET and URL the content items. The URL consists of the path to the WCM connect servlet '/wps/wcm/myconnect/ the sitepath as described earlier and lastly using a WCM query parameter (?presentationtemplate=) the format for the results and the parameter (&subtype=json) to get the content as JSON. Example, /wps/wcm/myconnect/spa/spa+demo/exceptional+digital+expereinece+conference?presentationt emplate=wcm+spa/json&subtype=json

AJAX with Web Content Manager Standard Menu 5 The Presentation Template uses the standard WCM tag library to result the results in a JSON format, for example the name key value pair is name : followed by the WCM Property tag of the current content items title field. The summary, body and imageuri are similar but use different WCM tags and formatting. Presentation Template "name":"[property context="current" type="content" htmlencode="true" field="title"]", "summary":"[plugin:copytext count="1" format="trim" escape="json" text="[element context='current' type='content' key='summary']"]", "body": "[Plugin:CopyText count="1" format="trim" escape="json" text="[element context='current' type='content' key='body']"]", "imageuri": "[Plugin:CopyText count="1" format="trim" escape="json" text="[element context='current' type='content' key='library Index Image' format='url']"]" } The JSON payload is returned to the getcontent function which parses the results updating the <div id=contentbody> and <div id=contentsummary> in the container HTML component. Performance benefits can be gained through using jquery as it provides default caching of XHR requests.

AJAX with explicit JSON payload management 6 AJAX with explicit JSON payload management The second sample shows how to generate JSON from a menu and then use this data to generate the list programmatically. It uses many of the same elements of the first sample but a Script Portlet has been used instead of the Web Content Viewer application and also just a single WCM Menu component. Figure 2 Sample 2, sequence diagram. The JavaScript code requests the menu component JSON Event Menu and returns the queried contents in JSON format as explicitly described, the subtype=json WCM parameter sets the correct content type for the payload. JSON has been used for the results in this step (the event menu) for flexibility and reuse. The WCM menu could have returned HTML however JSON is used for easier programmatic iteration and general post processing. The menu will return a key value pair of name and link using the WCM placeholder tag= title and tag= sitepath tags. As in the previous sample the configuration of the menu query is the same as we want to show the same content. Menu component "entry":["name":"[placeholder tag="title"]", "link":"[placeholder tag="sitepath"]"}] } Each item returned in the JSON payload an unordered list is created, each lineitem being an a href call to the function updatecontent followed by the URL link and content item name we just retrieved Example, "name":"exceptional Digital Experience, "link":"/spa/spa+demo/ Exceptional+Digital+Expereinece+Conference "}

7 Finally, the function call updatecontent is identical to the previous samples getcontent and updates the <div id=contentbody> and <div id=contentsummary> in the container HTML when an item is clicked. This sample uses the Script Portlet application. To take advantage of WCM syndication the page where the script portlet is placed should be linked with a site area in your library. For example the /SPA library By default the script portlet artefacts are created in the Portal home library.

Web Content Manager REST API 8 Web Content Manager REST API The third sample shows using the WCM REST API to programmatically retrieve the content items and details rather than using a standard menu and the Connect servlet. Its uses a defined query to fetch all of the content created with a specific authoring template. The REST API is geared towards content creation and this example is provided to show how you could achieve the same results as in samples 1 and 2 using just the API. As with the previous sample this third samples uses some of the sae elements, including the HTML, CSS and some of the JavaScript functions. Figure 3 - Sample 3, sequence diagram. The code initially requests the id of the Event authoring template so that in the next step all content created with this templates id can be returned in a JSON formatted payload. Snipped of the JSON returned Event id "feed" : "id" : "wcmrest:query?name=event&pragma=nocache&type=contenttemplate", "title" : "wcmrest:query?name=event&pragma=nocache&type=contenttemplate", "updated" : "Mon, 02 Mar 2015 15:20:56.786Z", "entry" : [ "id" : "wcmrest:69daf411-9d84-48f1-97e8-c22ff2ac6b68", "title" :

Web Content Manager REST API 9 }, "lang" : "en", "value" : "Event" A WCM REST query is used to return all the results for content items that have been created with the Event content template using the id= wcmrest:69daf411-9d84-48f1-97e8-c22ff2ac6b68. The results will be in JSON format. Snipped of the JSON returned for Event content items "feed" : "id" : "wcmrest:query?authoringtemplateid=wcmrest%3a69daf411-9d84-48f1-97e8-c22ff2ac6b68&pagesize=30", "title" : "wcmrest:query?authoringtemplateid=wcmrest%3a69daf411-9d84-48f1-97e8-c22ff2ac6b68&pagesize=30", "updated" : "Mon, 02 Mar 2015 15:20:57.119Z", "link" : [ "rel" : "next-page", "href" : "/wps/mycontenthandler/!ut/p/digest!g08wqjsvlyolohmznffnaa/wcmrest/query? pagesize=30&authoringtemplateid=wcmrest%3a69daf411-9d84-48f1-97e8- c22ff2ac6b68&page=2", "lang" : "en", "label" : "Next Page" } ], "entry" : [ "id" : "wcmrest:6059d298-8c2a-4974-8302-4b3a219589d8", "title" : "lang" : "en", "value" : "SpeCTCular" }, "summary" : "lang" : "en" }, "name" : "SpeCTCular 2013", "type" : "Content", "updated" : "Wed, 17 Dec 2014 07:59:44.204Z", "author" : [ "distinguishedname" : "uid=virtuser,o=defaultwimfilebasedrealm", "uri" : "/wps/mycontenthandler/!ut/p/digest!g08wqjsvlyolohmznffnaa/um/users/profi les/z9eae3ro03qocnpc8mm4co9p4jmg643e4jm07l9c6mm8c6jdcmg17h9d2mr86g1", "name" : "virtuser" }

Web Content Manager REST API 10 As with Sample 2 for each item returned in the JSON payload an unordered list is created, each lineitem being an a href call to the function updatecontent followed by the URL link and content item name we just retrieved Example, "name":"exceptional Digital Experience, "link":"/spa/spa+demo/ Exceptional+Digital+Expereinece+Conference "} Finally, the function updatecontent is called to retrieve the content item s contents when the link title is click. This is different to the previous sample as the JSON payload contains more value pairs than before, also the previous samples JSON was explicitly controlled with WCM tags. The individual content item is requested using the ajax GET request /wps/mycontenthandler/wcmrest/content/' + id[1], the id array containing wcmrest:6059d298-8c2a-4974-8302-4b3a219589d8, once again the result returned in JSON. Iterating through the JSON returned for the content item the Body, Summary and Library Index Image are returned. A secondary request for an image is required if a Library Index Image is found When using the REST API if the content item contains a component reference, for example a file or image an additional REST call is required to return the final component URL. A useful feature of the REST API is that it provides for content paging by default. Using other mechanisms would require the use of WCM paging components. The <div id=contentbody> and <div id=contentsummary> in the container HTML is updated when an item link is clicked.

Content as a Service (Caas) 11 Content as a Service (Caas) This feature capability was introduced into the continuous deliver stream CF05 for IBM WebSphere Portal v8.5, in order to use this your system needs to be at this level. If you are on a lower level of v8.5 then you can upgrade simply using the Installation Manager (automated download and install) or via FixCentral (manual).

Appendix 12 Appendix IBM Script Portlet Application https://greenhouse.lotus.com/plugins/plugincatalog.nsf/assetdetails.xsp?action=editdocument&do cumentid=ddb5c467d991413285257c67002476e0 JQuery Learn Centre - http://learn.jquery.com/ REST Service for Web Content Manager http://www-01.ibm.com/support/knowledgecenter/ssdk36_8.5.0/wcm/wcm_rest.dita WCM REST Component Formats http://www- 01.ibm.com/support/knowledgecenter/SSDK36_8.5.0/wcm/wcm_rest_content_formats.html Authors Rob Enright IBM Digital Experience Strategist Stuart Crump IBM Certified L2 Senior IT Specialist, IBM Collaboration Solutions