%META:TOPICPARENT{name="Ods"}% %TOC% ---+ OpenSocial API support ---++ APIs supported The ODS package contains OpenSocial data APIs about people and activities. Also it implements a login compatible with GBase which can be used to perform OpenSocial API calls requiring authentication. The implementation code is located in the opensocial.sql file from the ods package. ---++ Authentication The authentication is compatible with GBase ClientLogin username/password authentication. ---+++ REST API details * URI: http://<cname>:<port>/feeds/login ---+++Parameters * Uname - the ODS user account * Passwd - password ---+++Return * On success it will return: auth=NNNN where NNNN... is a security token and it matches a SID for login to ODS. * If authentication fails it will return: Error=BadAuthentication ---+++ Sample session $ curl -i "http://localhost/feeds/login?Uname=test&Passwd=secret" HTTP/1.1 200 OK Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB Connection: Keep-Alive Date: Wed, 14 Nov 2007 16:44:42 GMT Accept-Ranges: bytes Content-Type: text/plain; charset="ISO-8859-1" Content-Length: 38 auth=f305177cb1d9fbf409579250e944e980 ---++ People API The people API is implemented as described in http://code.google.com/apis/opensocial/docs/gdata/people/developers_guide_protocol.html The only difference is that personID is not a number but ODS user account. ---+++ Sample Session ---++++ Person data $ curl -i "http://localhost:8890/feeds/people/demo" HTTP/1.1 200 OK Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB Connection: Keep-Alive Date: Wed, 14 Nov 2007 16:49:27 GMT Accept-Ranges: bytes Content-Type: application/atom+xml; charset="ISO-8859-1" Content-Length: 1018 http://localhost:8890/feeds/people/demo 2007-11-01T10:55:33.000+02:00 demo demo 43.000000 25.000000 +359887563204 ---++++ Friends $ curl -i "http://localhost:8890/feeds/people/demo/friends" HTTP/1.1 200 OK Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB Connection: Keep-Alive Date: Wed, 14 Nov 2007 16:50:14 GMT Accept-Ranges: bytes Content-Type: application/atom+xml; charset="ISO-8859-1" Content-Length: 2104 http://localhost:8890/feeds/people/demo/friends 2007-11-14T18:50:14.000+02:00 demo's Friends demo http://localhost:8890/feeds/people/dav 2007-11-01T10:33:10.000+02:00 WebDAV System Administrator http://localhost:8890/feeds/people/alice 2007-11-02T18:01:04.000+02:00 alice ---++ Activities API The activities API is implemented as described in http://code.google.com/apis/opensocial/docs/gdata/activities/developers_guide_protocol.html ---+++ Creating entries To create a new entry client must be authenticated first, then it issue a POST request to the activities feed an Atom based xml representation like : 2007-10-29T19:00:51.574Z I'm at work The server will respond with entry containing atom:id element, below is a simple session for creating a new entry. The "ODS Auth" value is the sid value for the logged in user demo in ODS. curl -i -d "`cat act.xml`" -H "Authorization: ODS Auth=032a81d688a275910bd5ef31aff6d5ab" -H "Content-Type: application/atom+xml" "http://localhost:8890/activities/feeds/activities/user/demo/source/0" HTTP/1.1 201 Created Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB Connection: Keep-Alive Date: Thu, 15 Nov 2007 12:25:10 GMT Accept-Ranges: bytes Content-Type: application/atom+xml; charset="ISO-8859-1" Content-Length: 636 http://localhost:8890/activities/feeds/activities/user/demo/source/0/10 2007-11-15T14:25:10.000+02:00 I'm at work 2007-11-15T14:25:10.000+02:00 ---+++ Retrieving entries The feed retrieval is just a GET against user activities feed, e.g., GET http://localhost:8890/activities/feeds/activities/user/demo produces a Atom feed with users activities listed ---+++ Updating entries The update is similar to entry creation, but in this case the HTTP method must be PUT and the Atom entry must contain a valid atom:id, for example: http://localhost:8890/activities/feeds/activities/user/demo/source/12/8 2007-10-27T19:41:51.574Z Another Edited title 2007-10-27T19:41:51.478Z ---+++ Deleting entries It's the same as update, just in this case the HTTP method is DELETE. In cases where clients do not support PUT/DELETE , the X-HTTP-Method-Override HTTP header is supported; i.e., DELETE can be represented by : POST /url HTTP/1.1 X-HTTP-Method-Override: DELETE .... CategoryODS CategoryVirtuoso CategoryWebSite