Skip to content

buddycloud and the REST

June 8, 2012


I took MUCH too long to write this, but here it is: the first post on my Google Summer of Code 2012 project for the XSF.

Before diving into what I have done and will be doing, I’ll introduce myself quickly. My name is Denis Washington, I’m 22 years old and I study Computer Science at the Humboldt University of Berlin (I’m in my fourth semester currently). I have a passion for everything open and collaborative when it comes to software, the web, protocols and standards. I use Ubuntu as my main operating system and love to use my free time to hack code, play indie games and spend time with my wonderful girlfriend. I am also a sucker for programming languages and love to learn a new one, like, every six months or so. 🙂

Anyway, here is what I am up to: for buddycloud, I’m developing a small server that allows its clients to access and modify buddycloud channels through a REST-like HTTP API. What this means is that every channel stream and post can be addressed with an HTTP URL, retrieved as an ordinary Atom document, modified, posted to and much more. This is going to open up a great deal of opportunities for interoperability between buddycloud and the web. For instance, here are some use cases copied from my project’s wiki page at

  • “Post To Channel” button: Joe maintains a cute cat picture gallery site and wants to give his visitors the possibility to share one of these with their kitten-loving buddycloud friends. For this reason, every picture should have a “Post to Channel” button which, when clicked, lets the user choose from a list of his or her subscribed channels and automatically posts a link to the picure to that channel. Using the HTTP API, he can program this easily with only a few XmlHttpRequests and absolutely no knowledge of the underlying XMPP communication.
  • External following: Alice is a talented indie game developer who often talks on conferences about good game design and her newest game projects. On one of these conferences she meets Bob, who is very interested in what Alice is doing and would love to follow her newest game development activities and which conferences she is going to speak in. However, Alice writes about these things mostly in a public buddycloud channel, while Bob is Friendica user. However, Alice is able to give Bob an HTTP URI which, when Bob pastes it into Friendica’s Atom connector, allows him to have Alice’s posts seamlessly integrated into his Friendica message stream without having to create a buddycloud account only for this reason.
  • Automation: Karen is the system administrator of a small open-source project which mainly communicates through a buddycloud channel. To not have old bug reports forgotten, she has the idea to randomly choose a selection of old unresolved bugs – say, older than six months – from the bug tracker every two weeks and highlight them by posting them to the project’s channel. She is able to quickly automate this process by writing a server cron job which leverages the HTTP API through simple invocations of the ubiquitous cURL command-line utility.

Many more use cases are imaginable. And as buddycloud channels are technically not much more than collections of Atom-based XMPP Publish-Subscribe nodes, the code does not only apply for buddycloud, but could also be useful for to other Pub-Sub based systems. (I am currently concentrating on making it work nicely with buddycloud, though.)

So how far am I? Currently, retrieving and posting to channel streams is completely working. Authenticating requests by passing in a JID and a password (via HTTP Basic Auth) is also implemented. This means that with the soon-to-be-deployed HTTP API server on, you’ll be able to do requests like this one:

GET /channels/ HTTP/1.1

HTTP/1.1 200 OK
<feed xmlns="">
  <entry id="…">
    <content>This is the newest post!</content>

or this one:

POST /channels/
Authorization: Basic …
Content-Type: application/atom+xml
<entry xmlns="">
  <content>Hey, my first channel post via HTTP!</content>

HTTP/1.1 201 Created
Location: /channels/…

And – my favorite – you’ll be able to follow channels with your feed reader:

Thunderbird supports feeds protected with HTTP Basic, so you can even follow private channels!

For more details on the API looks, see the already-mentioned wiki page. (Not everything described there is implemented yet.)  The code can be found at Github.

Next up on my todo list – other than polishing and cleaning up what I have so far – is implementing access to a channel stream’s metadata (for instance, who is subscribed to it), as well as the possibility to (un)subscribe a channel stream. Stay tuned.

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: