• Facebook Application

last modified May 30, 2008 by skleinfeldt

Use case: A Facebook application that integrates calendar information from a Plone site into Facebook.

I want to show the list of upcoming events on my profile, and I want to be able to add and edit events from Facebook.

Web services:

  • Get a list of all events (title, url, description) for a Plone site, or maybe events from a particular folder, or that match certain criteria (date range, author, keyword...)
  • For each event, get its information (from the url on the list)
  • Add and edit an event


There could be a similar application for news, or for a custom content type.

From Christian Scholz:

I think I actually would use microformats for this use case. They are already well understood and not hard to implement. But of course the index of the pages with an event are missing. In all such areas it might be good to have a look on how other sites solve this problem. This also might be part of the whole Data Portability Group work.

Regarding the searching for content the question is if it's just URL parameters or something else. This would mean of course that the calling app needs to know about them. If that's the case then maybe putting this logic into Plone might make more sense. E.g. have a list of my own upcoming events on Plone or, marked up with hCalendar which Facebook can parse (if it's hCalendar actually many more tools could possibly parse it without knowing any syntax). Of course we could actually also simply use the search page with parameters to get the results we want and then either read microformats or maybe ask that page to convert the output to some other format.

Basically if Plone would have more microformat support many things could already be marked up with it. Like addresses, links etc.

For me most interesting are the areas where maybe some web services already exist, like do upcoming or eventful have some APIs so we can easily use them? I think the main focus is probably reading information from a Plone site as then existing formats can be used. For writing there are probably only a few people experimenting with it as it always includes authorization issues.


That does of course not mean that we shouldn't provide support for people to implement it, just that right now the out of the box experience might be somewhat limited. You always have to write your own endpoint.

Let me try to get into the details of one use case in which some user e.g. installs a Facebook app to display some events in it which also might be secured by a password usually:

1. User installs Facebook app
2. FB app asks user for the URL of the events
3. User enters her page on a Plone site
4. FB detects that the page is protected
5. FB tries to discover which authorization mechanisms are available and detetcs OAuth
6. FB sends user to a Plone page for authorizing the access to this page
7. Plone site notices that user is not logged in and asks her to do so
8. User logs in
9. Plone site asks if access to that page is not allowed, once or everytime allowed
10. User chooses "Everytime"
11. Plone site redirects back to FB app
12. FB app retrieves events with the access token it got.
13. FB app parses the hCalendar microformats and display the event
13. User is happy and dancing

Point 5 here is a bit blurry as I haven't yet read the OAuth Discovery spec ;-) Right now OAuth assumes that the service provider and the consumer both know about each other in terms of which services the provider has and where the URLs for them are (e.g. the flickr Uploadr knows which URL it has to access to send the photos to flickr or get information). Partly these things always need docs as it's hard to formalize every imaginable web service but at least OAuth detection might be solved by the OAuth Discovery spec. More on that after I've read it.

Regarding a detailed use case about writing I am not sure how much sense it makes as it's most likely a custom client application anyway which calls it these days. But it would be cool if something like a photo upload API of flickr could be standardized and we'd have a way to upload photos with some flickr uploading tool to Plone.

The only thing which comes to mind here is the Atom Publishing Protocol but I haven't really looked into that but I think some people on this list have :) Is it RESTful?

From Reinout van Rees:

The atom publishing protocol is definitively restful. Many of APP's authors have been some of the most vocal proponents of REST :-) iirc they almost want it to be a generic-purpose publishing protocol for everything where an atom output would make sense. And that's quite a lot.  

From Sean Gilles:

FWIW, Grok has a neat RESTful approach that could be useful

  http://grok.zope.org/documentation/how-to/rest-support-in-grok

I've used it to implement AtomPub in this application

  http://zcologia.com/kw/demo/map

which draws from an AtomPub collection at

  http://zcologia.com/kw/++rest++knowhere/demo

The downside is ugly URLs. Have you considered that what you might really need is OpenSocial for Plone?