OpenSocial: Social Javascript
This is a site about technology for developers, so I won’t get into any politics on OpenSocial and Facebook. There is already more coverage on that than you could want to read.
How is a social API interesting to Ajax developers? The main interface to the social data is through JavaScript. You can also use REST to hit the endpoints themselves, but the JavaScript API is very much the first class citizen.
If you are used to the Google Gadgets API you will probably be most familiar. Social components just have to include a one liner to their ModulePrefs:
This tells the container that you will be doing social tasks. There are three main APIs that you now have access too:
- People Data API: You can get access to owners and viewers, and their friends
- Persistence Data API: Store simple hash table data for the users using your application
- Activities Data API: Like the Facebook News feed
You will probably want to grab some social data which requires you to setup a request and grab data:
When you want to work with user data such as preferences, you will use the storage api. Here is an example from WoShamBo:
