Skip to end of metadata
Go to start of metadata

About

IBM Connections 4 API allows to add a comment to a status update message. Here's one easy way to do it with an asynchronous HTTP (Ajax) request using jQuery.

Atom API Request Details

Header

Content-Type: application/json; charset=UTF-8

Type

POST

URL

{host}/connections/opensocial/rest/ublog/@all/@all/{post-id}/comments

Example

https://www.mysite.com/connections/opensocial/rest/ublog/@all/@all/urn:lsid:lconn.ibm.com:profiles.note:9aff-37f-fd-ac0-de478bc/comments

Response

Status Code: 200 OK

Note

The post id corresponds to the rollupid of the entry that is part of the Connections JSON.

Example Request

{"content":" hello word "}

Note: The only element that  requires value is content, the rest should be sent empty.

Example using jQuery

var strData = '{"content":" hello word "}';
 
$.ajax({
    url : "https://www.mysite.com/connections/opensocial/rest/ublog/@all/@all/urn:lsid:lconn.ibm.com:profiles.note:9aff-37f-fd-ac0-de478bc/comments",
    type : "POST",
    contentType: "application/json; charset=UTF-8",
    async : true,
    data: strData,
    statusCode : {
        200 : function() {
            console.log('comment 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