|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Features OpenSocial for Application Developers
Access a social network's friends and update feeds
Mar. 12, 2009 07:45 AM
OpenSocial defines a common API for social applications across multiple websites. Built from standard JavaScript and HTML, developers can create applications with OpenSocial that access a social network's friends and update feeds. By using a common API, developers can extend the reach of their applications more quickly, yielding more functionality for users. [1] This article will be covering all the aspects around the OpenSocial Practice - from the basics of developing an application inside the Social Network (Gadget Container) using the JavaScript API, passing over the use of the RESTful API to code desktop or mobile applications or server-to-server communication, to the implementation of Shindig in a social network so it can be an OpenSocial Container that accepts these applications. OpenSocial for Application Developers The four big services that can be accessed from this API are People, Data, Activity Stream, and Messaging. 1. People Service // Example code to retieve the viewers profile data function handleRequestMe(data) { 2. Activity Stream Service 3. Data Service 4. Messaging Service RESTful API Overview [3] The protocol is defined on top of the HTTP protocol and uses the standard HTTP verbs (GET, POST, PUT, DELETE, etc.) to retrieve and update the server data. This API offers the same four services as the JavaScript API but it uses AtomPub and JSON dual representation for each resource. For example, to get the Profile record for user {guid} you'll consume this service: /people/{guid}/@self The response in AtomPub [4] will be <entry xmlns="http://www.w3.org/2005/Atom"> And in JSON { Security Model var params = {}; You are left with other two secure options: the Signed and the OAuth requests. For the Signed Request, the container needs to vouch for the user's identity to the destination server. The container does this by removing some specific request parameters and adding, among others, opensocial_owner_id and opensocial_app_url, and then signing the resulting request according to the OAuth specification. This way in each request the destination server will have all the information needed about the app and the active users, and it can, at the same moment, verify it via a public/private key for the data integrity. // For SIGNED Type Requests add this param gadgets.io.makeRequest(url, callback, params); For the OAuth request the procedure consists of several steps in which authentication tokens are exchanged between the application (Consumer) and the server requested (Service Provider). The OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers. More generally, OAuth creates a freely implementable and generic methodology for API authentication. An example use case is allowing printing service printer.example.com (the Consumer), to access private photos stored on photos.example.net (the Service Provider) without requiring Users to provide their photos.example.net credentials to printer.example.com. [5] // For OAUTH Type Requests add this param This way, in each request the OAuth token will be sent to validate the access to the specific resource. Internationalization Then you have to structure your code to separate specific visible text and replace it with a unique name that will be replaced automatically by the server for each message bundle in the viewer's language. Thus, the gadget gets translated and becomes available to a new bunch of users. OpenSocial for Container Developers
The first two implementations are language-agnostic, since they are coded in JavaScript + HTML and consume the services that the Data and Gadget servers provide. The last two are coded in Java and PHP. The Shindig Java and PHP implementations share the same set of features and are mainly a port of each other. For the JavaScript API they also use the same set of libraries. Both are production-ready and running in several containers supporting millions of users. The adoption of this Apache Foundation open source project decreases the time-to-market of the containers since it has an estimated effort of 10-person years and a robust, scalable, and easy-to-integrate code base. It also leverages the use of Open Standards such as OpenID and OAuth and it has a very strong open source community around it. These are some Hi5 [7] result numbers.
- 10k req/sec edge - 6k req/sec origin
Conclusion What are you waiting for? Grab your favorite text editor and start coding that application you have had in your mind for a long time - there are more than 300 million OpenSocial users willing to use it! References 2. http://code.google.com/apis/opensocial/ zdocs/0.8/reference/ 3. http://www.opensocial.org/Technical-Resources/opensocial-spec-v081/restful- 4. http://www.ietf.org/rfc/rfc4287.txt 5. http://oauth.net/core/1.0/ - OAuth Core 1.0 - Abstract Reader Feedback: Page 1 of 1
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||