The IDK methods for Collaboration Server are terribly sparse – you can’t get calendar events, file sizes, or a whole bunch of other critical data that you may want if you were to actually embark on a mission to write a better UI for Collab (trust me, I have). Sure you could try and use the woefully undocumented Collab API – I’ve shown you how to deploy the portal API in the past – but that’s a challenge in and of itself.

Instead, let’s look at an alternate approach: use the Collab Server as a sort of REST API. It’s not really, but the basic idea is that you use URLs in your code to directly call functionality in Collaboration Server to do certain tasks. For example, say you want to add a Collaboration project to a page programmatically; there is no mechanism to do this through the IDK, and we have no idea how to use the API, but using a header tool, we find that through Project Explorer, it works with a simple URL: /collab/do/project/selector/add?commPage=true&projID=COLLABID.

So, it turns out we can do the same thing programmatically, by using Java’s network libraries to call that URL directly (setting the proper authenticationid). The code after the jump shows an example of how to do this; we use this approach in Integryst’s Automater, which allows you to script a bunch of actions at a time (what good is automatically creating a collab project if you can’t add it to a community page you just created!?).

One Response to “Treat Collaboration Server as a REST-based API”

Awesome idea! I wish actually that they had gotten a chance to build out a better REST API.

The WebCenter team has been adding more rest functionality to the WebCenter framework and services. If you have seen the iPhone app in the iTunes market that is a great example of what you can build using just the REST APIs.

Omid

ps. You should put that “conn.disconnect()” in a finally statement if you are using that in a long running process 🙂