As it happens, the Facebook API is pretty easy to work with. I've made a lot of progress since the earlier post; I can now execute simple queries against the API and get useful data back. I also abstracted things out to a Connection class and a Session class, so the raw API isn't front and center anymore. Here's the usage model (bearing in mind that I'm building a desktop interface here):
holder := FacebookSecretHolder new
apiKey: apiKey;
secretKey: secret.
FacebookAPI new
executeMethod: method
withKey: holder apiKey
withSecret: holder secretKey.
That sets up the necessary key information; here's the way you interact:
connection := Connection withSecretHolder: holder.
connection clearSession.
connection login.
At that point you have to deal with a web page; that's Facebook's API. If you're not logged in, you do that on the page. Then it's back to the app:
connection getSession.
ids := connection friendsGet.
connection getFriendsNamesFor: ids.
connection statusGet.
connection clearSession.
The friend query returns first and last names (it's getting minimal info back at the moment; the #getStatus returns the last 100 updates. Finally, #clearSession logs out. That's it - I'll do more tomorrow.
Technorati Tags:
social media, facebook