Skip to end of metadata
Go to start of metadata

About

To post a reply to a topic in a stand-alone forum, send an Atom entry document containing the forum reply to the forum replies resource. Here's one easy way to do it with an asynchronous HTTP (Ajax) request using jQuery.

IBM Connections 4 documentation link: Reply to a topic

Atom API Request Details

Header

Content-Type : application/atom+xml
TypePOST
URL

{host}/forums/atom/replies?topicUuid={topic-id}

Example:

https://www.mysite.com/forums/atom/replies?topicUuid=ee4-2c25-4264-951-ca2

Response

Status Code: 201 Created

Example Request

<entry xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns="http://www.w3.org/2005/Atom">
    <title type="text">Reply</title>
    <content type="text">Test reply</content>
    <category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="forum-reply"></category>
    <thr:in-reply-to
     xmlns:thr="http://purl.org/syndication/thread/1.0"
     ref="urn:lsid:ibm.com:forum:ee4-2c25-4264-951-ca2"
     href="https://www.mysite.com/forums/html/topic?id=ee4-2c25-4264-951-ca2">
   </thr:in-reply-to>
</entry>

In line 7,8 must be used the same id as the one used on the URL {topic-id}

Example using jQuery

var strData = '<entry xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns="http://www.w3.org/2005/Atom">';
strData += '<title type="text">Replay</title>';
strData += '<content type="text">Test reply 1</content>';
strData += '<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="forum-reply"></category>';
strData += '<thr:in-reply-to';
strData += ' xmlns:thr="http://purl.org/syndication/thread/1.0"';
strData += ' ref="urn:lsid:ibm.com:forum:ee4-2c25-4264-951-ca2"';
strData += ' href="https://www.mysite.com/forums/html/topic?id=ee4-2c25-4264-951-ca2">';
strData += '</thr:in-reply-to></entry>';

$.ajax({
    url : "https://www.mysite.com/forums/atom/replies?topicUuid=ee4-2c25-4264-951-ca2",
    type : "POST",
    contentType: "application/atom+xml; charset=UTF-8",
    async : true,
    data: strData,
    statusCode : {
        201 : function() {
            console.log('reply posted');
        }
    },
    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