Skip to main content

Introducing REST-based services for wiki and blog content in IBM Lotus Quickr 8.1.1 services for IBM WebSphere Portal

Derek Carr (dwcarr@us.ibm.com), Advisory Software Engineer, IBM
Derek Carr is an Advisory Software Engineer at IBM working with the Lotus Quickr team in Research Triangle Park, NC. You can reach Derek at dwcarr@us.ibm.com.
Danny Levenson (dlevenso@us.ibm.com), Software Developer, IBM
Danny Levenson is a Software Developer working with the IBM Lotus Quickr team in Durham, NC. You can reach Danny at dlevenso@us.ibm.com.
Xu Jin Liu (liuxujin@cn.ibm.com), Software Engineer, IBM
Liu Xu Jin is a Software Engineer at IBM working with the IBM Lotus Quickr Service team in Beijing, China. You can reach Xu Jin at liuxujin@cn.ibm.com.
Qin (Alice) Jun (qinjun@cn.ibm.com), Software Engineer, IBM
Qin Jun (Alice) is a Software Engineer at IBM working with the Lotus Quickr team in the China Software Development Lab in Beijing, You can reach Alice at qinjun@cn.ibm.com

Summary:  In IBM® Lotus® Quickr™ versions earlier than 8.1.1, the public APIs supported only document-related services. Lotus Quickr 8.1.1 now has REST-based services for wiki and blog content, to enable creating, viewing, updating, and deleting wiki and blog content inside Lotus Quickr. This article focuses on the REST-style wiki and blog content service APIs, their usage, and how they can be leveraged to build custom solutions.

Date:  16 Sep 2009 (Published 16 Jun 2009)
Level:  Intermediate
Activity:  6607 views

Editor's note: Know a lot about this topic? Want to share your expertise? Participate in the IBM Lotus software wiki program today.

Lotus Quickr wikiWebSphere Portal wiki

Introduction

Lotus Quickr is team collaboration software designed to transform the way documents and Web content are shared, helping users to collaborate and work efficiently across teams. It provides a set of public APIs to access content inside Lotus Quickr and build solutions appropriate to customers' need.

In Lotus Quickr versions prior to 8.1.1, the public APIs supported only document-related services. In version 8.1.1, Lotus Quickr enhances Representational State Transfer (REST)-based services, providing the features to let users get, create, update, and delete wiki and blog content through REST-based services. Users can also perform coordinated operations on comments to the wiki and blog content.

To help explain wiki-and-blog-content REST-based services, we describe the supported URL patterns, HTTP methods, and request parameters. In addition, sample requests and responses are provided, as well as create, read, update, and delete (CRUD) operations on wiki and blog content and comments.

Finally, we present live sample code for listing the blog entries in a blog library, creating a blog entry, and commenting on a blog entry, to help you further understand these REST-based services.


Prerequisites

To get the most from this article, you should already have an understanding of the following:

  • Lotus Quickr
  • REST services
  • Atom syndication format
  • Basic knowledge of IBM WebSphere® Portal and IBM Lotus Web Content Management
  • Java™ programming

Wiki and blog content

In this section, we discuss the servlet context and all the supported services for wikis and blogs, including the servlet context's URL pattern, supported HTTP methods, and request parameters. A sample request and response for each service are also listed.

Servlet context

Unlike Lotus Quickr document REST services, the servlet context of wiki-and-blog REST services is webcontent/rest, instead of dm/atom, and is described as follows:

  • All the services’ full paths should be in the pattern <protocol>://<host>:<port>/webcontent/rest/<url-pattern>. For example, if the protocol is HTTP, and the server is lwptsthink43.cn.example.com,and the port is 10038, then for this service, its full path should be:

    http://lwptsthink43.cn.example.com:10038/webcontent/rest/introspection
  • This service returns a service document containing a link for libraries and feed.
  • Only the GET method is supported on this service.
  • This GET method requires authentication and does not support anonymous access.
  • No extra arguments and HTTP headers are supported.

Below is a sample request and a sample response (see listing 1).

Sample request: GET /webcontent/rest/introspection HTTP/1.1


Listing 1. Sample response
<?xml version="1.0" encoding="UTF-8"?>
<service xmlns="http://purl.org/atom/app#" 
xmlns:atom="http://www.w3.org/2005/Atom">
  <workspace>
    <atom:title type="text">MediaLibrary Documents</atom:title>
    <collection 
    href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/libraries/feed">
      <atom:title type="text">All Libraries</atom:title>
      <accept>application/*,image/*,*/*</accept>
    </collection>
    <collection href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/libraries/
    feed?category=wiki">
      <atom:title type="text">All wiki libraries</atom:title>
      <accept>application/*,image/*,*/*</accept>
    </collection>
    <collection href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/libraries/
    feed?category=blog">
      <atom:title type="text">All blog libraries</atom:title>
      <accept>application/*,image/*,*/*</accept>
    </collection>
  </workspace>
</service>

<host>:<port>/libraries/feed

This service is described as follows:

  • It returns a feed of the component libraries in Lotus Web Content Management.
  • Only the GET method is supported on this service.
  • This GET method requires authentication and does not support anonymous access.

The supported arguments are listed in table 1.


Table 1. Supported arguments for <host>:<port>/libraries/feed
ArgumentValueOn requestDescription
category wiki, blog, allOptionalLimits the list of libraries to be of the specified type
placeIdplace id OptionalLimits the list to be the component libraries contained in the specified place
page1, 2, 3, and so onOptionalSpecifies page to be retrieved assuming constant page size
pagesize10, 20, and so onOptionalSpecifies number of items to include in a paged request
sKpublished, created, modifiedOptionalThe key to sort the response
sOdsc, ascOptionalThe order to sort the response
aclsfalse, trueOptionalSpecifies whether the authenticated user’s permissions are returned in each library

where, in the above table:

  • The default value for any argument is marked in bold.
  • Every place in the placeId argument can include many wiki or blog libraries; if a user specifies the place ID, then only the libraries in this place can be returned.
  • If the acls argument is set to true, the current users’ permissions on each resource are returned. The permissions include View, Edit, Delete, and AddChild.
  • The Manager role has all permissions; the Editor role has View, Edit, and AddChild permissions; the Contributor role has View and AddChild permissions; and the Reader role has only View permission.

Below is a sample request and a sample response (see listing 2).

Sample request: GET /webcontent/rest/libraries/feed?acls=true HTTP/1.1


Listing 2. Sample response
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>urn:lsid:ibm.com:td:libraries</id>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/libraries/
  feed" rel="self"></link>
  <category term="library" scheme="tag:ibm.com,2006:td/type" l
  abel="library"></category>
  <title type="text">All Libraries</title>
  <generator uri="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/" 
  version="1.0">Teamspace Web Content</generator>
  <updated>2008-11-26T07:29:05.422Z</updated>
  <entry xmlns:td="urn:ibm.com/td">
    <id>urn:lsid:ibm.com:td:7a1cd3004be710acb161f18ffc876575</id>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7a1cd3004be710acb161f18ffc876575/entry" rel="self"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/lotus/poc/?
    uri=wcm%3aa93444004be710aeb181f18ffc876575" rel="alternate"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7a1cd3004be710acb161f18ffc876575/entry" rel="edit"></link>
    <category term="library" scheme="tag:ibm.com,2006:td/type" 
    label="library"></category>
    <category term="wiki" scheme="tag:ibm.com,2006:td/type" 
    label="wiki"></category>
    <title type="text">Wiki</title>
    <summary type="text">Allows the creation of wiki pages with user content by 
    teamspace members.</summary>
    <td:label>7a1bd3804be710aab160f18ffc876575</td:label>
    <published>2008-11-12T05:57:50.078Z</published>
    <updated>2008-11-25T09:13:58.875Z</updated>
    <td:modified>2008-11-12T05:57:50.078Z</td:modified>
    <td:created>2008-11-12T05:57:50.078Z</td:created>
<content type="application/atom+xml" src="http://lwptsthink43.cn.ibm.com:10038/
webcontent/rest/library/7a1cd3004be710acb161f18ffc876575/feed"></content>
<td:permissions>Delete,Edit,AddChild,View</td:permissions>
  </entry>
  <entry xmlns:td="urn:ibm.com/td">
    <id>urn:lsid:ibm.com:td:daf4dd004be710a5b135f18ffc876575</id>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    daf4dd004be710a5b135f18ffc876575/entry" rel="self"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/lotus/poc/?uri=
    wcm%3a7e93bc804be710a9b15bf18ffc876575" rel="alternate"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    daf4dd004be710a5b135f18ffc876575/entry" rel="edit"></link>
    <category term="library" scheme="tag:ibm.com,2006:td/type" 
    label="library"></category>
    <category term="blog" scheme="tag:ibm.com,2006:td/type" 
    label="blog"></category>
    <title type="text">Blog</title>
    <summary type="text">Allows the posting of blog entries and comments by 
    teamspace members.</summary>
    <td:label>b6006a004be710a5b134f18ffc876575</td:label>
    <published>2008-11-12T05:57:47.234Z</published>
    <updated>2008-11-25T09:13:59.703Z</updated>
    <td:modified>2008-11-12T05:57:47.234Z</td:modified>
    <td:created>2008-11-12T05:57:47.234Z</td:created>
<content type="application/atom+xml" src="http://lwptsthink43.cn.ibm.com:10038/
webcontent/rest/library/daf4dd004be710a5b135f18ffc876575/feed"></content>
<td:permissions>AddChild,View</td:permissions>
  </entry>
</feed>

/library/{library-id}/entry

This service returns the entry of a user-specified library, and only the GET method is supported on it.

Table 2 shows the supported argument.


Table 2. Supported argument for library/{library-id}/entry
Argument ValueOn requestDescription
aclsfalse, trueOptionalSpecifies whether the authenticated user’s permissions are returned on each library

Below is the sample request and the response (see listing 3).

Sample request: GET /webcontent/rest/library/7a1cd3004be710acb161f18ffc876575/entry?acls=true HTTP/1.1


Listing 3. Sample response
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:7a1cd3004be710acb161f18ffc876575</id> 
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7a1cd3004be710acb161f18ffc876575/entry" rel="self" /> 
  <link href="http://lwptsthink43.cn.ibm.com:10038/lotus/poc/?uri=
  wcm%3aa93444004be710aeb181f18ffc876575" rel="alternate" /> 
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7a1cd3004be710acb161f18ffc876575/entry" rel="edit" /> 
  <category term="library" scheme="tag:ibm.com,2006:td/type" label="library" /> 
  <category term="wiki" scheme="tag:ibm.com,2006:td/type" label="wiki" /> 
  <title type="text">Wiki</title> 
  <summary type="text">Allows the creation of wiki pages with user content by 
  teamspace members.</summary> 
  <td:label>7a1bd3804be710aab160f18ffc876575</td:label> 
  <published>2008-11-12T05:57:50.078Z</published> 
  <updated>2008-11-25T09:13:58.875Z</updated> 
  <td:modified>2008-11-12T05:57:50.078Z</td:modified> 
  <td:created>2008-11-12T05:57:50.078Z</td:created> 
  <content type="application/atom+xml" src="http://lwptsthink43.cn.ibm.com:10038/
  webcontent/rest/library/7a1cd3004be710acb161f18ffc876575/feed" /> 
  <td:permissions>Delete,Edit,AddChild,View</td:permissions> 
  </entry>

/library/{library-id}/feed

For this service:

  • Both the GET and POST methods are supported.
  • POST creates a new document in the specified library (that is, wiki page or blog post).
  • GET returns a feed of the documents in the specified library.

All of the arguments shown in table 3 are supported for the GET method; the POST method supports inline and acls argument in order to control what is returned from the server in response to creating a new artifact.


Table 3. Supported arguments for the GET method
ArgumentValueOn requestDescription
inlinefalse, trueOptionalEntries contain actual content rather than src attribute with a link to the content when inline=true
page1, 2, 3, and so onOptionalSpecifies page to be retrieved assuming constant page size
pagesize10, 20, and so onOptionalSpecifies number of items to include in a paged request
sKtitle, updated, published, created, modifiedOptionalThe key to sort the response
sOdsc, ascOptionalThe order to sort the response
aclsfalse, trueOptionalSpecifies whether the authenticated user’s permissions are returned for each document

When the inline argument is set to true, the <content> element of the entry is the real content of the wiki page or blog entry (for more details, see the sample response). If it is set to false, the <content> element of the entry is like the following:

<content src=http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
7a1cd3004be710acb161f18ffc876575/document/a93444004be710aeb181f18ffc876575/
media type="text/html">
</content>

Below is the sample request and the response (see listing 4):

For the GET method

Sample request:

GET /webcontent/rest/library/7a1cd3004be710acb161f18ffc876575/feed?inline=true HTTP/1.1
Listing 4. Sample response
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>urn:lsid:ibm.com:td:7a1cd3004be710acb161f18ffc876575</id>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7a1cd3004be710acb161f18ffc876575/feed" rel="self"></link>
  <category term="library" scheme="tag:ibm.com,2006:td/type" 
  label="library"></category>
  <title type="text">Wiki</title>
  <generator uri="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7a1cd3004be710acb161f18ffc876575/" version="1.0">Teamspace 
  Web Content</generator>
  <updated>2008-11-10T03:40:23.469Z</updated>
  <collection href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7a1cd3004be710acb161f18ffc876575/feed" xmlns="http://purl.org/atom/app#">
    <atom:title type="text" xmlns:atom="http://www.w3.org/2005/Atom">
    Wiki</atom:title>
    <accept>text/html,application/atom+xml</accept>
  </collection>
  <entry xmlns:td="urn:ibm.com/td">
    <id>urn:lsid:ibm.com:td:a93444004be710aeb181f18ffc876575</id>
    <title type="text">Welcome to your new Wiki</title>
    <published>2007-01-30T21:17:44.220Z</published>
    <updated>2008-11-10T03:40:23.469Z</updated>
    <td:modified>2008-11-10T03:40:23.469Z</td:modified>
    <td:created>2007-01-30T21:17:44.220Z</td:created>
    <summary type="text">Use the Team Wiki to communicate thoughts 
    about project.</summary>
    <td:uuid>a93444004be710aeb181f18ffc876575</td:uuid>
    <author>
      <name>wpsadmin g wpsadmin sn</name>
      <email>wpsadmin@cn.ibm.com</email>
      <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts
      %2Cc%3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
    </author>
    <link href="/lotus/poc/?uri=wcm%3aa93444004be710aeb181f18ffc876575" rel="alternate"></link>
    <content type="html">Use the Team Wiki to communicate thoughts about project, 
    ideas, and to share information. You can start a thought in the wiki and then watch 
    as team members respond. Team Wiki is a good place to brainstorm with the team.
    <br> Click "Edit Page" to get started.<br> Tip: Use the wiki instead 
    of email. Because questions and answers are often hidden in personal email, post a 
    blog to generate quick responses that are visible to the team.<p style="margin: 
    0px;"></p></content>
    <category scheme="tag:ibm.com,2006:td/" label="document" 
    term="document"></category>
    <category scheme="tag:ibm.com,2006:td/" label="page" 
    term="page"></category>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7a1cd3004be710acb161f18ffc876575/document/a93444004be710aeb181f18ffc876575/
    entry" rel="self"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7a1cd3004be710acb161f18ffc876575/document/a93444004be710aeb181f18ffc876575/
    entry" rel="edit"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7a1cd3004be710acb161f18ffc876575/document/a93444004be710aeb181f18ffc876575/feed" 
    rel="replies"></link>
  </entry>
</feed>

For the POST method

Below are the sample request and response (see listings 5 and 6, respectively).


Listing 5. Sample request
POST /webcontent/rest/library/7a1cd3004be710acb161f18ffc876575/feed?inline=true HTTP/1.1
Host: lwptsthink43.cn.ibm.com
Content-Type: application/msword
Content-Length: nnnn
Authorization: Basic ...
<entry xmlns="http://www.w3.org/2005/Atom">
   <content type="html"><p><b> </b>&nbsp;&nbsp;
   Programmatically created entry.</p>
   </content>
   <title type="text">Test Entry Title
   </title>
   <summary type="text">Summary for Test Entry Ttile
   </summary>
</entry>


Listing 6. Sample response
HTTP/1.1 200 OK
Date: Fri, 13 Apr 2007 17:17:11 GMT
Content-Length: nnn
Content-Type: application/atom+xml; charset="utf-8"
Location: http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/entry
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:6df9c6004c127f26bc10fdaa37d7846a</id>
  <title type="text">Test Entry Title </title>
  <published>2008-11-26T09:32:39.484Z</published>
  <updated>2008-11-26T09:32:39.984Z</updated>
  <td:modified>2008-11-26T09:32:39.984Z</td:modified>
  <td:created>2008-11-26T09:32:39.484Z</td:created>
  <summary type="text">Summary for Test Entry Title</summary>
  <td:uuid>6df9c6004c127f26bc10fdaa37d7846a</td:uuid>
  <author>
    <name>wpsadmin g wpsadmin sn</name>
    <email>wpsadmin@cn.ibm.com</email>
    <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc
    %3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
  </author>
  <link href="/lotus/poc/?uri=wcm%3a6df9c6004c127f26bc10fdaa37d7846a" 
  rel="alternate"></link>
  <content type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/
  rest/library/6b1fc9804a9207249ceadc23ebd19157/document/
  6df9c6004c127f26bc10fdaa37d7846a/media"></content>
  <category scheme="tag:ibm.com,2006:td/" label="document" 
  term="document"></category>
  <category scheme="tag:ibm.com,2006:td/" label="page" 
  term="page"></category>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/entry" 
  rel="self"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/entry" 
  rel="edit"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/feed" 
  rel="replies"></link>
</entry>

/library/{library-id}/document/{document-id}/entry

For this service, the GET, PUT, and DELETE methods are supported, where:

  • GET returns an entry for the specified document.
  • PUT updates the specified document.
  • DELETE deletes the specified document.

The argument in table 4 is supported only for the GET method; the PUT and DELETE methods do not support any arguments.


Table 4. Supported argument for the GET method
Argument ValueOn requestDescription
aclsfalse, trueOptionalSpecifies whether the authenticated user’s permissions are returned in each library
For the GET method

Below is the sample request and the response (see listing 7).

Sample request:

GET /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/
document/886a62804c128889bc18fdaa37d7846a/entry HTTP/1.1

Listing 7. Sample response
<?xml version="1.0" encoding="UTF-8" ?> 
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:886a62804c128889bc18fdaa37d7846a</id> 
  <title type="text">Test Entry Title</title> 
  <published>2008-11-26T09:49:51.609Z</published> 
  <updated>2008-11-26T09:49:51.609Z</updated> 
  <td:modified>2008-11-26T09:49:51.609Z</td:modified> 
  <td:created>2008-11-26T09:49:51.609Z</td:created> 
  <summary type="text">Programmatically created entry summary</summary> 
  <td:uuid>886a62804c128889bc18fdaa37d7846a</td:uuid> 
 <author>
  <name>wpsadmin g wpsadmin sn</name> 
  <email>wpsadmin@cn.ibm.com</email> 
  <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc%3Dus
  %2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri> 
  </author>
  <link href="/lotus/poc/?uri=wcm%3a886a62804c128889bc18fdaa37d7846a" rel="alternate" /> 
 <content 
	type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
	7e0bad004a9206d69c88dc23ebd19157/document/886a62804c128889bc18fdaa37d7846a/
	media" /> 
  <category scheme="tag:ibm.com,2006:td/" label="document" term="document" /> 
 <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
 7e0bad004a9206d69c88dc23ebd19157/document/886a62804c128889bc18fdaa37d7846a/entry" 
 rel="self" /> 
 <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
 7e0bad004a9206d69c88dc23ebd19157/document/886a62804c128889bc18fdaa37d7846a/entry" 
 rel="edit" /> 
 <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
 7e0bad004a9206d69c88dc23ebd19157/document/886a62804c128889bc18fdaa37d7846a/feed" 
 rel="replies" /> 
</entry>

For the PUT method

Below are the sample request and response (see listings 8 and 9, respectively).


Listing 8. Sample request
PUT /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/
document/886a62804c128889bc18fdaa37d7846a/entry HTTP/1.1 
Host: lwptsthink43.cn.ibm.com
Content-Length: nnnn
Authorization: Basic ...
<entry xmlns="http://www.w3.org/2005/Atom">
   <content type="html"><p><b> </b>&nbsp;&nbsp;
   Programmatically Updated entry.</p>
   </content>
   <title type="text">Test Entry Title-Updated
   </title>
   <summary type="text">Summary for Test Entry Ttile-Updated
   </summary>
</entry>


Listing 9. Sample response
HTTP/1.1 200 OK
Date: Fri, 13 Apr 2007 17:17:11 GMT
Content-Length: nnn
Content-Type: application/atom+xml; charset="utf-8"
Location: http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/entry
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:6df9c6004c127f26bc10fdaa37d7846a</id>
  <title type="text">Test Entry Title-Updated </title>
  <published>2008-11-26T09:32:39.484Z</published>
  <updated>2008-11-26T09:32:39.984Z</updated>
  <td:modified>2008-11-26T09:32:39.984Z</td:modified>
  <td:created>2008-11-26T09:32:39.484Z</td:created>
  <summary type="text">Summary for Test Entry Title-Updated </summary>
  <td:uuid>6df9c6004c127f26bc10fdaa37d7846a</td:uuid>
  <author>
    <name>wpsadmin g wpsadmin sn</name>
    <email>wpsadmin@cn.ibm.com</email>
    <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc
    %3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
  </author>
  <link href="/lotus/poc/?uri=wcm%3a6df9c6004c127f26bc10fdaa37d7846a" rel="alternate"></link>
  <content type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/
  rest/library/6b1fc9804a9207249ceadc23ebd19157/
  document/6df9c6004c127f26bc10fdaa37d7846a/media"></content>
  <category scheme="tag:ibm.com,2006:td/" label="document" 
  term="document"></category>
  <category scheme="tag:ibm.com,2006:td/" label="page" 
  term="page"></category>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/entry" 
  rel="self"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/entry" 
  rel="edit"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/6df9c6004c127f26bc10fdaa37d7846a/feed" 
  rel="replies"></link>
</entry>

For the DELETE method

Here are the sample request and response.

Sample request:

Delete /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/
document/886a62804c128889bc18fdaa37d7846a/entry HTTP/1.1
Host: lwptsthink43.cn.ibm.com
Authorization: Basic ...

Sample response:

HTTP/1.1 200 OK
Date: Fri, 13 Apr 2008 17:17:11 GMT

/library/{library-id}/document/{document-id}/feed

In this service, both the GET and POST methods are supported, where:

  • POST creates a new comment for the specified document.
  • GET returns a feed for the comments for the specified document.

The arguments in table 5 are supported only for the GET method; the POST method does not support any arguments.


Table 5. Supported arguments for the GET method
ArgumentValueOn requestDescription
inlinefalse, trueOptionalEntries contain actual content rather than src attribute with a link to the content when inline=true
page1, 2, 3, and so onOptionalSpecifies page to be retrieved assuming constant page size
pagesize10, 20, and so onOptionalSpecifies number of items to include in a paged request
sKtitle, updated, publishedOptionalThe key to sort the response
sOdsc, ascOptionalThe order to sort the response
aclsfalse, trueOptionalSpecifies whether the authenticated user’s permissions are returned on each comment
For the GET method

Below is the sample request and the response (see listing 10).

Sample request:

GET /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/document/
886a62804c128889bc18fdaa37d7846a/feed HTTP/1.1

Listing 10. Sample response
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>urn:lsid:ibm.com:td:886a62804c128889bc18fdaa37d7846a</id>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7e0bad004a9206d69c88dc23ebd19157/document/886a62804c128889bc18fdaa37d7846a/feed" 
  rel="self"></link>
  <category term="comment" scheme="tag:ibm.com,2006:td/type" 
  label="comment"></category>
  <title type="text">Test Entry</title>
  <generator uri="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7e0bad004a9206d69c88dc23ebd19157/" 
  version="1.0">Teamspace Web Content</generator>
  <updated>2008-11-27T01:31:02.906Z</updated>
  <collection href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7e0bad004a9206d69c88dc23ebd19157/document/886a62804c128889bc18fdaa37d7846a/feed" 
  xmlns="http://purl.org/atom/app#">
    <atom:title type="text" xmlns:atom="http://www.w3.org/2005/Atom">
    Test Entry</atom:title>
    <accept>text/html,application/atom+xml</accept>
  </collection>
  <entry xmlns:td="urn:ibm.com/td">
    <id>urn:lsid:ibm.com:td:fb73a7804c148a23bc28fdaa37d7846a</id>
    <title type="text">wpsadmin g wpsadmin sn Today at 9:31 AM</title>
    <published>2008-11-27T01:31:02.906Z</published>
    <updated>2008-11-27T01:31:02.906Z</updated>
    <td:modified>2008-11-27T01:31:02.906Z</td:modified>
    <td:created>2008-11-27T01:31:02.906Z</td:created>
    <summary type="text">test again</summary>
    <td:uuid>fb73a7804c148a23bc28fdaa37d7846a</td:uuid>
    <author>
      <name>wpsadmin g wpsadmin sn</name>
      <email>wpsadmin@cn.ibm.com</email>
      <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc
      %3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
    </author>
    <link href="/lotus/poc/?uri=wcm%3afb73a7804c148a23bc28fdaa37d7846a" 
    rel="alternate"></link>
    <content type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/
webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/document/
1c1cef804c1488b4bc1afdaa37d7846a/comment/fb73a7804c148a23bc28fdaa37d7846a/
media"></content>
    <category scheme="tag:ibm.com,2006:td/" label="comment" 
    term="comment"></category>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7e0bad004a9206d69c88dc23ebd19157/document/1c1cef804c1488b4bc1afdaa37d7846a/
    comment/fb73a7804c148a23bc28fdaa37d7846a/entry" rel="self"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7e0bad004a9206d69c88dc23ebd19157/document/1c1cef804c1488b4bc1afdaa37d7846a/
    comment/fb73a7804c148a23bc28fdaa37d7846a/entry" rel="edit"></link>
  </entry>
  <entry xmlns:td="urn:ibm.com/td">
    <id>urn:lsid:ibm.com:td:d23708004c1488b9bc26fdaa37d7846a</id>
    <title type="text">wpsadmin g wpsadmin sn Today at 9:28 AM</title>
    <published>2008-11-27T01:28:28.344Z</published>
    <updated>2008-11-27T01:28:28.344Z</updated>
    <td:modified>2008-11-27T01:28:28.344Z</td:modified>
    <td:created>2008-11-27T01:28:28.344Z</td:created>
    <summary type="text">test</summary>
    <td:uuid>d23708004c1488b9bc26fdaa37d7846a</td:uuid>
    <author>
      <name>wpsadmin g wpsadmin sn</name>
      <email>wpsadmin@cn.ibm.com</email>
      <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts
      %2Cc%3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
    </author>
    <link href="/lotus/poc/?uri=wcm%3ad23708004c1488b9bc26fdaa37d7846a" 
    rel="alternate"></link>
    <content type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/
    rest/library/7e0bad004a9206d69c88dc23ebd19157/document/
    1c1cef804c1488b4bc1afdaa37d7846a/comment/d23708004c1488b9bc26fdaa37d7846a/
    media"></content>
    <category scheme="tag:ibm.com,2006:td/" label="comment" 
    term="comment"></category>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7e0bad004a9206d69c88dc23ebd19157/document/1c1cef804c1488b4bc1afdaa37d7846a/
    comment/d23708004c1488b9bc26fdaa37d7846a/entry" rel="self"></link>
    <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
    7e0bad004a9206d69c88dc23ebd19157/document/1c1cef804c1488b4bc1afdaa37d7846a/
    comment/d23708004c1488b9bc26fdaa37d7846a/entry" rel="edit"></link>
  </entry>
</feed>

For the POST method

Here are the sample request and response (see listings 11 and 12, respectively).


Listing 11. Sample request
POST /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/
document/886a62804c128889bc18fdaa37d7846a/feed HTTP/1.1
Host: lwptsthink43.cn.ibm.com
Content-Type: application/msword
Content-Length: nnnn
Authorization: Basic ...
<entry xmlns="http://www.w3.org/2005/Atom">
   <content type="html"><p><b> </b>
   &nbsp;&nbsp;Programmatically created entry.</p>
   </content>
   <title type="text">Test Entry Title
   </title>
   <category scheme="tag:ibgm.com,2006:td/type" term="comment">
   </category>
</entry>


Listing 12. Sample response
HTTP/1.1 200 OK
Date: Fri, 13 Apr 2008 17:17:11 GMT
Content-Length: nnn
Content-Type: application/atom+xml; charset="utf-8"
Location: http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
6b1fc9804a9207249ceadc23ebd19157/document/096d53804c148da9bc34fdaa37d7846a/
comment/096d53804c148da9bc33fdaa37d7846a/entry
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:096d53804c148da9bc33fdaa37d7846a</id>
  <title type="text">wpsadmin g wpsadmin sn Today at 9:37 AM</title>
  <published>2008-11-27T01:37:30.500Z</published>
  <updated>2008-11-27T01:37:30.672Z</updated>
  <td:modified>2008-11-27T01:37:30.672Z</td:modified>
  <td:created>2008-11-27T01:37:30.500Z</td:created>
  <summary type="text">Thu Nov 27 09:42:45 CST 2008  
  Programmatically created comment.</summary>
  <td:uuid>096d53804c148da9bc33fdaa37d7846a</td:uuid>
  <author>
    <name>wpsadmin g wpsadmin sn</name>
    <email>wpsadmin@cn.ibm.com</email>
    <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc
    %3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
  </author>
  <link href="/lotus/poc/?uri=wcm%3a096d53804c148da9bc33fdaa37d7846a" 
  rel="alternate"></link>
  < contenttype="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/
rest/library/6b1fc9804a9207249ceadc23ebd19157/document/096d53804c148da9bc34fdaa37d7846a/
comment/096d53804c148da9bc33fdaa37d7846a/media"></content>
  <category scheme="tag:ibm.com,2006:td/" label="comment" 
  term="comment"></category>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/096d53804c148da9bc34fdaa37d7846a/comment/
  096d53804c148da9bc33fdaa37d7846a/entry" rel="self"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/096d53804c148da9bc34fdaa37d7846a/
  comment/096d53804c148da9bc33fdaa37d7846a/entry" rel="edit"></link>
</entry>

/library/{library-id}/document/{document-id}/comment/comment-id}/entry

The GET, PUT, and DELETE methods are supported for this service, where:

  • GET returns an entry for the specified comment.
  • PUT updates the specified comment.
  • DELETE deletes the specified comment.

The argument in table 6 is supported only when performing the GET method; the PUT and DELETE methods do not support any arguments.


Table 6. Supported argument for the GET method
Argument ValueOn requestDescription
aclsfalse, trueOptionalSpecifies whether the authenticated user’s permissions are returned for each library
For the GET method

Below is the sample request and the response (see listing 13).

Sample request:

GET /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/document/
40dc74004c149271bc3cfdaa37d7846a/comment/55eeec804c1492ddbc44fdaa37d7846a/entry HTTP/1.1

Listing 13. Sample response
 <?xml version="1.0" encoding="UTF-8" ?> 
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:55eeec804c1492ddbc44fdaa37d7846a</id> 
  <title type="text">wpsadmin g wpsadmin sn Today at 9:47 AM</title> 
  <published>2008-11-27T01:47:02.109Z</published> 
  <updated>2008-11-27T01:47:02.109Z</updated> 
  <td:modified>2008-11-27T01:47:02.109Z</td:modified> 
  <td:created>2008-11-27T01:47:02.109Z</td:created> 
  <summary type="text">this is the first comment</summary> 
  <td:uuid>55eeec804c1492ddbc44fdaa37d7846a</td:uuid> 
  <author>
    <name>wpsadmin g wpsadmin sn</name> 
    <email>wpsadmin@cn.ibm.com</email> 
   <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc
   %3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri> 
</author>
   <link href="/lotus/poc/?uri=wcm%3a55eeec804c1492ddbc44fdaa37d7846a" rel="alternate" /> 
  <content type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7e0bad004a9206d69c88dc23ebd19157/document/766a77004c1492dcbc3efdaa37d7846a/comment/
  55eeec804c1492ddbc44fdaa37d7846a/media" /> 
   <category scheme="tag:ibm.com,2006:td/" label="comment" term="comment" /> 
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7e0bad004a9206d69c88dc23ebd19157/document/766a77004c1492dcbc3efdaa37d7846a/comment/
  55eeec804c1492ddbc44fdaa37d7846a/entry" rel="self" /> 
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  7e0bad004a9206d69c88dc23ebd19157/document/766a77004c1492dcbc3efdaa37d7846a/
  comment/55eeec804c1492ddbc44fdaa37d7846a/entry" rel="edit" /> 
 </entry>

For the PUT method

Below are the sample request and response (see listings 14 and 15, respectively).


Listing 14. Sample request
PUT /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/document/
40dc74004c149271bc3cfdaa37d7846a/comment/55eeec804c1492ddbc44fdaa37d7846a/entry HTTP/1.1
Host: lwptsthink43.cn.ibm.com
Content-Length: nnnn
Authorization: Basic ...
<entry xmlns="http://www.w3.org/2005/Atom">
   <content type="html"><p><b> </b>
   &nbsp;&nbsp;Programmatically Updated entry.</p>
   </content>
   <title type="text">Test Entry Title-Updated
   </title>
   <summary type="text">Summary for Test Entry Ttile-Updated
   </summary>
</entry>


Listing 15. Sample response
HTTP/1.1 200 OK
Date: Fri, 13 Apr 2007 17:17:11 GMT
Content-Length: nnn
Content-Type: application/atom+xml; charset="utf-8"
Location: http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
6b1fc9804a9207249ceadc23ebd19157/document/014241804c149b27bc52fdaa37d7846a/entry
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
  <id>urn:lsid:ibm.com:td:014241804c149b27bc52fdaa37d7846a</id>
  <title type="text">API_Automation_Test:Test Entry - Thu Nov 27 10:07:28 
  CST 2008</title>
  <published>2008-11-27T02:02:13.375Z</published>
  <updated>2008-11-27T02:02:13.812Z</updated>
  <td:modified>2008-11-27T02:02:13.812Z</td:modified>
  <td:created>2008-11-27T02:02:13.375Z</td:created>
  <summary type="text">Summary for: API_Automation_Test:Test Entry - 
  Thu Nov 27 10:07:28 CST 2008</summary>
  <td:uuid>014241804c149b27bc52fdaa37d7846a</td:uuid>
  <author>
    <name>wpsadmin g wpsadmin sn</name>
    <email>wpsadmin@cn.ibm.com</email>
    <uri>uid%3Dwpsadmin%2Ccn%3Dusers%2Cl%3Dwestford%2Cst%3Dmassachusetts%2Cc
    %3Dus%2Cou%3Dlotus%2Co%3Dsoftware+group%2Cdc%3Dibm%2Cdc%3Dcom</uri>
  </author>
  <link href="/lotus/poc/?uri=wcm%3a014241804c149b27bc52fdaa37d7846a" 
  rel="alternate"></link>
  <content type="text/html" src="http://lwptsthink43.cn.ibm.com:10038/webcontent/
  rest/library/6b1fc9804a9207249ceadc23ebd19157/document/
  014241804c149b27bc52fdaa37d7846a/media"></content>
  <category scheme="tag:ibm.com,2006:td/" label="document" 
  term="document"></category>
  <category scheme="tag:ibm.com,2006:td/" label="page" 
  term="page"></category>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/014241804c149b27bc52fdaa37d7846a/entry" 
  rel="self"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/014241804c149b27bc52fdaa37d7846a/entry" 
  rel="edit"></link>
  <link href="http://lwptsthink43.cn.ibm.com:10038/webcontent/rest/library/
  6b1fc9804a9207249ceadc23ebd19157/document/014241804c149b27bc52fdaa37d7846a/feed" 
  rel="replies"></link>
</entry>

For the DELETE method

Below are the sample request and response.

Sample request:

Delete /webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/document/
40dc74004c149271bc3cfdaa37d7846a/comment/55eeec804c1492ddbc44fdaa37d7846a/entry HTTP/1.1
Host: lwptsthink43.cn.ibm.com
Authorization: Basic ...

Sample response:

HTTP/1.1 200 OK
Date: Fri, 13 Apr 2007 17:17:11 GMT

Consuming services in practice

In this section, we introduce real-life examples of how to list blog entries in a blog library, how to create a blog entry, and how to add a comment for the blog entry.

Apache Abdera is used for Atom publishing and response parsing throughout the example. For more details, see the developerWorks® article, "Getting to know the Atom Publishing Protocol, Part 3: Introducing the Apache Abdera project."

Listing the blog entries in a blog library

As mentioned previously, to get the blog entries into a blog library, send a Getting request to the URL
https://localhost:10038/webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/feed as shown in the code snippet in listing 16.


Listing 16. Getting request
public void getLibraryFeed() throws Exception
  {
    String url = “https://localhost:10038/webcontent/rest/
library/7e0bad004a9206d69c88dc23ebd19157/feed”;
	//create an abdera client
	CommonsClient client = new CommonsClient();
Credentials creds = new UsernamePasswordCredentials(“mshani”, “password”);
    client.addCredentials(url, null, null, creds);
client.usePreemptiveAuthentication(true);

//Send the Getting request
    ClientRespone response = client.get(url);
    Element blogElement = response.getDocument().getRoot();
    releaseResponse();
    Feed blogFeed = (Feed) blogElement;
    List list = blogFeed.getEntries();
    Iterator iter = list.iterator();
    while (iter.hasNext())
{
  //Every entry means a blog entry 
      Entry entry = iter.next();
      //Get the blog entry’s infromation
	  String title = entry.getTitle();
	  String summary = entry.getSummary();
      String author = entry.getAuthor().getName();
	  //Render the blog entry’s title, summary and name to the User Interface.
      ………… 
      …………
    }
  }

Thus a blog entry is added to the blog library (see figure 1).


Figure 1. Blog entry added to blog library
Blog entry added to blog library

Creating a new blog entry

To create a blog entry, send an HTTP POST request into the library feed URL:
http://localhost:10038/webcontent/rest/library/7e0bad004a9206d69c88dc23ebd19157/feed as shown in the code snippet in listing 17.


Listing 17. HTTP POST request
public String createBlogEntry() throws Exception
  {
     String url = “https://localhost:10038/webcontent/rest/
library/7e0bad004a9206d69c88dc23ebd19157/feed”;
	//create an abdera client
	CommonsClient client = new CommonsClient();
Credentials creds = new UsernamePasswordCredentials(“mshani”, “password”);
    client.addCredentials(url, null, null, creds);
client.usePreemptiveAuthentication(true);

//Create an posted abdera entry
	Entry blogEntry = Abdera.getNewFactory.newEntry();
    //set the blog entry title    
    blogEntry.setTitle("IntroDucing REST based services for wiki and blog content");
String summary = "<p><b>Learn how to create web content using REST based 
services</b></p>”;
//set the blog entry summary
blogEntry.setContentAsHtml(summary);

//Send the POST request
    ClientRespone response = client.post(url, blogEntry);
    Element blogElement = response.getDocument().getRoot();
    releaseResponse();
Entry entry = (Entry) blogElement;
QName QNAME_UUID = new QName("urn:ibm.com/td", ”uuid”, “td”);
String blogEntryUUID = entry.getSimpleExtension(QNAME_UUID);
    
    return  blogEntryUUID;
  }

Thus a new blog entry is successfully created (see figure 2).


Figure 2. New blog entry
New blog entry

Adding a comment for the blog entry

To add a comment for a blog entry, we need to post a comment entry in the blog entry feed. The posted URL should look like the following:

http://localost:10038/webcontent/rest/library/12c41d804d2f16e9af42efa98d8a5f1c/
document/704e15004d2f7c5baf76efa98d8a5f1c/feed

And the code snippet should look like that shown in listing 18.


Listing 18. Posting a comment entry in the blog feed
public String createBlogEntry() throws Exception
  {
     String url = “http://localost:10038/webcontent/rest/library/
     12c41d804d2f16e9af42efa98d8a5f1c/document/704e15004d2f7c5baf76efa98d8a5f1c/feed”;
	//create an abdera client
	CommonsClient client = new CommonsClient();
Credentials creds = new UsernamePasswordCredentials(“mshani”, “password”);
    client.addCredentials(url, null, null, creds);
client.usePreemptiveAuthentication(true);

//Create an posted abdera entry
	Entry commentEntry = Abdera.getNewFactory.newEntry();
    //set the comment entry title    
    String summary = "<p><b>This is a good article which is 
    worthy to read</b></p>”;
//set the blog entry summary
commentEntry.setContentAsHtml(summary);
//Set the entry category
	Category category = factory.newCategory();
    category.setScheme("tag:ibgm.com,2006:td/type");
    category.setTerm("comment");
commentEntry.addCategory(category);

//Send the POST request
    ClientRespone response = client.post(url, commentEntry);
    Element commentElement = response.getDocument().getRoot();
    releaseResponse();
Entry entry = (Entry) commentElement;
QName QNAME_UUID = new QName("urn:ibm.com/td", ”uuid”, “td”);
String commentUUID = entry.getSimpleExtension(QNAME_UUID);
    
    return  commentUUID;
  }

Thus a blog entry’s comment is created, as shown in figure 3.


Figure 3. Blog entry’s comment
 Blog entry’s comment

In this section, we’ve shown actual examples of how to list blog entries in a blog library, create a blog entry, and comment on a blog entry. The procedure for other operations, for example, updating or deleting a blog entry or updating or deleting a blog entry’s comment, is quite similar to these three operations.


Conclusion

Lotus Quickr REST-based services for wiki and blog content provide a convenient, robust means to access Web content in Lotus Quickr for WebSphere Portal. Users can get all the wiki and blog libraries’ information, can create, update, and delete a specified wiki page or blog entry, and can CRUD a specified comment.

With the help of these services, users can customize their personalized Web content presentation. What’s more, these services align with the format of Lotus Quickr REST-based document services, making them easy to understand and use.


Resources

Learn

Get products and technologies

Discuss

About the authors

Derek Carr is an Advisory Software Engineer at IBM working with the Lotus Quickr team in Research Triangle Park, NC. You can reach Derek at dwcarr@us.ibm.com.

Danny Levenson is a Software Developer working with the IBM Lotus Quickr team in Durham, NC. You can reach Danny at dlevenso@us.ibm.com.

Liu Xu Jin is a Software Engineer at IBM working with the IBM Lotus Quickr Service team in Beijing, China. You can reach Xu Jin at liuxujin@cn.ibm.com.

Qin Jun (Alice) is a Software Engineer at IBM working with the Lotus Quickr team in the China Software Development Lab in Beijing, You can reach Alice at qinjun@cn.ibm.com

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Lotus, WebSphere
ArticleID=397583
ArticleTitle=Introducing REST-based services for wiki and blog content in IBM Lotus Quickr 8.1.1 services for IBM WebSphere Portal
publish-date=09162009
author1-email=dwcarr@us.ibm.com
author1-email-cc=
author2-email=dlevenso@us.ibm.com
author2-email-cc=
author3-email=liuxujin@cn.ibm.com
author3-email-cc=
author4-email=qinjun@cn.ibm.com
author4-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers