« What's up with Rolle... | Main | SocialSite's OpenSoc... »

SocialSite's Opensocial extensions, part 1: Web services

<img title="OpenSocial logo" align="right" src="http://rollerweblogger.org/roller/resource/opensocial_140_140.jpg" />

I'm on SocialSite blog patrol this week, which means that I need to post interesting stuff at blogs.sun.com/socialsite, or here or both places at once.

So here's some blog fodder, a series of posts describing the extensions we are making to OpenSocial for Project SocialSite. I'll start by describing the web services, then the JavaScript API and finally I'll provide an example or two.

Background

As I may have mentioned before, the idea behind SocialSite is to add Social Networking features to existing web sites and applications. Any site or sites should be able to use our Widgets and Web Services to all the standard Social Networking features. To meet our Widget requirements we have to extend OpenSocial to support full read/write access to Social Graph data with support for "friending" with configurable relationship levels, profile editing, group invites, group management, application management and other things.

A word about implementation

On the server-side, our extensions are implemented as Shinding/Java DataRequestHandlers, which makes them available as both a REST API and a JSON-RPC interface. This means that they're available in a form very similar to that of the standard OpenSocial REST API and in a form very similar to the standard OpenSocial JSON-RPC API.

To give you an overview of the SocialSite extensions, I'll review the REST form of our APIs including all of the URIs we support and the HTTP verbs we support for each.

td.uri { width:40%; font-family: Courier; font-size: 10px; } td.data {width:5%; font-family: Courier; font-size: 10px; } td.verbs {width:55%;} td.uri, td.verbs, td.data { border-bottom: grey dotted 1px; vertical-align: text-top} td.routetitle {background: #efefef; color: black; padding: 3px;} table.apiref {width:100%; font-size:13px; margin-bottom: 0.5em;}

People and friending

The standard OpenSocial APIs don't support "friending" -- the process of requesting and negotiating some form of social relationship with another user. So, we've added some new URIs to the /people route in OpenSocial because support . These URIs return and accept standard OpenSocial Person objects, for example to request a relationship with somebody, you POST a representation of that person to your @friends collection.

People
/people/{userId}/@friends Person POST - Person to request or accept relationship
/people/{userId}/@requests Person GET - List of Persons requesting relationship
/people/{userId}/@requests/{personId} n/a DELETE - ignore a Person requesting relationship
/people/{userId}/@friends/{personId} n/a DELETE - remove relationship with Person

Profile editing and metadata

The standard OpenSocial APIs don't support creating and updating profile data. So, we've added new /profile and /profiledef routes to enable metadata driven profile property editing. You can create, retrieve and update profile properties for each user. You can also get metadata that defines all profile properties, their types and accepted values.

Profiles
/profiles/{userId} Profile GET - SocialSite profile data properties for one user
PUT - Update profile data for one user
/profiles Profile POST - add a new profile via SocialSite profile data properties
/profiledef ProfileDefinition GET - SocialSite profile property metadata in JSON format

Profile Privacy Settings

The standard OpenSocial APIs don't give you any control over who can see which parts of your profile or activities. So, in the standard SocialSite setup, we have grouped the standard OpenSocial properties into seven sections: identification, contact, extended contact, personal, more personal, experience and education. For each of these sections you can choose a visibility level; here they are from most restrictive to least: private, friends only, visible to some your groups, visible to all of your groups and public.

Privacy settings
/sectionprivs/{userId} List of SectionPrivacy GET - section privacy settings for user
/sectionprivs/{userId}/{sectionName} SectionPrivacy GET - section privacy setting for one profile section
PUT - update section privacy setting for one profile section

Group creation, management and invitations

The standard OpenSocial APIs don't support any group creation, management or invitation capabilities. So, we added those too. Like SocialSite Profiles, Groups have properties which are defined by a metadata definition file. Here are the URIs and HTTP verbs for each:

Groups
/groups/@public Group GET - all public groups
POST - create a new public group
/groups/@public/{groupId} Group GET - group specified by group ID
/groups/@public/@current Group GET - owning group specified by context (security token)
/groups/{userId} Group GET - all of user's groups
/groups/{userId}/@friends Group GET - all of user's friend's groups
/groupdef GroupDefinition GET - SocialSite group property metadata in JSON format

Looks like that's all I have time for today. Dinner time is here ;-) I'll cover the rest of the Web Services in part 2, later this week.

Comments:

Hi: these day I'm trying the socialsite,I get the source code and deploy it on the jboss, but it act not very perfect, I want to just use the socialsite's restful webservice , and develop my own pages, the service layer not very clear, can you show me how to invoke the socialsite's webservice? (Please show the example about Profile) thanks ray

Posted by ray on August 27, 2009 at 12:19 PM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed

« What's up with Rolle... | Main | SocialSite's OpenSoc... »

Welcome

This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog

Related entries

Below are the most recent entries in the category General, some may be related to this entry.