Skip to end of metadata
Go to start of metadata

About

To add a comment to a Wiki Page is required send a comment Atom entry document which includes the comment text. Here's one easy way to do it with an asynchronous HTTP (Ajax) request using jQuery.

There is no a link to IBM Connections 4 documentation.

Atom API Request Details

Headers

Content-Type : application/atom+xml;type=entry;charset=UTF-8
TypePOST
URL

{host}/wikis/basic/api/wiki/{wiki-id}/page/{wiki-page-id}/feed

Example:

https://www.mysite.com/wikis/basic/api/wiki/db65d9-1a14-964-b12f-bc531cfc5/page/00d9-ecdb-45-8c-fa2aaf/feed

ResponseStatus Code: 201 Created

Example Request

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<category term="comment" scheme="tag:ibm.com,2006:td/type" label="comment"></category>
<content type="text/plain">A comment to a wiki page</content>
</entry>
Example using jQuery

var strData = '<?xml version="1.0" encoding="UTF-8"?><entry xmlns="http://www.w3.org/2005/Atom">';
strData += '<category term="comment" scheme="tag:ibm.com,2006:td/type" label="comment">';
strData += '</category><content type="text/plain">A comment to a wiki page</content></entry>';
 
$.ajax({
    url : "https://www.mysite.com/wikis/basic/api/wiki/db65d9-1a14-964-b12f-bc531cfc5/page/00d9-ecdb-45-8c-fa2aaf/feed",
    type : "POST",
    contentType: "application/atom+xml;type=entry;charset=UTF-8",
    async : true,
    data: strData,
    statusCode : {
        201 : function() {
            console.log('comment created');
        }
    },
    error: function(jqXHR, textStatus, errorThrown) {
        console.log(jqXHR + " - " + textStatus + ' - ' + errorThrown);
    }
});

Note:  console.log can throw errors in IE, they are there for illustrative purposes only and should be changed as required.

About the author

Enterprise Web Developer
Joaquin is an Enterprise Web Developer at Base22 with over seven years of experience designing and developing web solutions for enterprise clients. He is a well rounded web developer with skills building interfaces in IBM WebSphere Portal and WCM, IBM Connections, and many others. He is an Oracle Certified Java Developer and a Microsoft Certified Visual Studio Developer. He blogs at http://j-arellano.com

  • No labels