Skip to end of metadata
Go to start of metadata

About

If you have not already liked a File posting, you can do so by sending a request to the file entry url. 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
TypePOST
Content-Typeapplication/atom+xml;type=entry;charset=UTF-8
URL

{host}/form/api/library/{library-id}/document/{doc-id}/feed

Example:

https://www.mysite.com/form/api/library/b6a18d-8371-4ba-a314-b5261d2/document/eaa6a9f-d4b-4ba-a03-9772adad8/feed

Data (XML)
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
  <category term="recommendation" label="recommendation"
  scheme="tag:ibm.com,2006:td/type" />
</entry>
ResponseStatus Code: 201 Created
Example using jQuery
var strData = '<?xml version="1.0" encoding="utf-8"?>';
strData += '<entry xmlns="http://www.w3.org/2005/Atom">';
strData += '<category term="recommendation" scheme="tag:ibm.com,2006:td/type"';
strData += 'label="recommendation" />';
strData += '</entry>';

 
$.ajax({
    url : "https://www.mysite.com/form/api/library/b6a18d-8371-4ba-a314-b5261d2/document/eaa6a9f-d4b-4ba-a03-9772adad8/feed",
    type : "POST",
    contentType: "application/atom+xml;type=entry;charset=UTF-8",
    async : true,
    data: strData,
    statusCode : {
        201 : function() {
            console.log('liked');
        }
    },
    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