Experimenting with the Google FriendConnect API
This evening, I started experimenting with the Google FriendConnect API. In particular, I wanted to see if I could get anywhere with the OpenSocial REST and RPC Protocol.
What I’m really interested in doing is writing a standalone PHP script that will go out to FriendConnect and gather information for me. Reading through the documents, it looks like I want to use the ‘standard two-legged OAuth’.
The example they gave said that I should be able to access
h ttp://www.google.com/friendconnect/api/people/@owner/@self?oauth_consumer_key=<your
consumer key>&oauth_signature_method=HMAC-SHA1&oauth_timestamp=<the time
right now in millis>&oauth_nonce=<some nonce>&oauth_signature=<signed using your secret>
By going to the FriendConnect page and selecting the ‘For Developers’ section and then going to the ‘REST API’ tab, I managed to find my Consumer Key and Consumer Secret. I attempted to retrieve various bits of information, mucking around with the ‘http://www.google.com/friendconnect/api’ base. With just about every variation, I received a 404 error and no useful information.
Figuring that I was probably doing something wrong with the OAuth settings, I downloaded the opensocial-php-client. The sample in Version 0.2 worked quite nicely when I attempted to use the key and secret that came in the sample, and went to "server_rest_base" => “http://sandbox.orkut.com/social/rest/”. However, when I tried changing the server_rest_base to http://www.google.com/friendconnect/ I received the same 404 errors. My guess is that there is something wrong with the documentation and I need to find a different server_rest_base. So far, I haven’t had any luck.
So, I thought I would try a different tack. I looked at the and found a sample for Drupal. I downloaded the plugin and installed it on one of my test servers. It installed properly and the installation portion seemed to work okay. However, when I configured it, it asked for a ‘Unique site identifier provided by Google Friend Connect during initial registration.’ I don’t think I have any such unique identifier, or at least if I do, I’m not sure what it is.
Looking at the various URLs for reports and settings for my site, I do find a twenty digit number that might be the unique site identifier, but I’m not sure if that is it. When I try to use the FriendConnect module for adding a comment, I get a box that says ‘loading…’ which seems to just hang there. So, it doesn’t seem to be working properly yet. In addition, since I’m mostly using Disqus for my comments, right now, I don’t see any great advantage for throwing on this Drupal plugin for FriendConnect.
Have you had any luck with the FriendConnect API? Let me know your experiences.