The Facebook API Menagerie
Facebook API has many different parts:
FB requests from your site, they inline the resonse in the middle of the page.
- Available: FBJS – a sandboxed limited JS API, FBML – a templating language, the FB session.
Your response is put in an IFRAME on the page.
- Available: FB session.
- Not available: FBJS, FBML.
Host your app on your own domain.
Connect back into FB to e.g. user their authentication & friends model.
- Available: Connect Session
- Not available: FB Session
- No JS
Think of FB as a browser
FB API LOLZ
- REST API – api/facebook.com/restserver.php – awesome URL.
- Facebook does not do GETs, they always POST to your site.
- Connect inside an iFrame, Connect requires the XHTML doctype to work, but iFrames are not supported in XHTML.
Running your App in development
- Create an app
- Setup DynDNS.com, point it at your IP address http://mysubdomain.dyndns.com
- open ports on your local network
- Add /etc/host entry: 0.0.0.0 facebook.dontexist.com
Abstract the API
- Use Facebooker.
- Access everything through the session
@friends = session[:facebook_session].user.friends.collect do |f|
Project your code
e.g. use rack-facebook so everything is not a POST
- Frakie: Facebooker for Sinatra
- rack-facebook: tranlates FB POST to correct action
How can I make things better?
- Need a test harness for session[:facebook_session]. There is something in facebooker that needs extraction.
- Greg is starting Faceboot API Continouus Integration Suite of Tests – github.com/atduskgreg/FACIST – some JS hooks to green/red light that your tags are actually showing up in the page.