After working with the Google Data, Flickr, Facebook, and Twitter APIs I have become very fond of RESTful data interfacing. Sending and receiving data via xml in such a simple manner is perfect for agile production while minimizing problems. Of all the APIs above, I found Facebook to be the most interesting. Sure, Google spans and endless number of services, but the Facebook API contains a depth that I have not seen before. They call it FQL and it is a home grown Facebook language for querying their database directly… very cool.
Since we plan to launch our service in Japan first, the Mixi API has become a priority. Mixi is based on the Open Social platform that has staked its claim in a number of popular services including MySpace and Google. To say the least I was very impressed.
What really caught my eye in the API was the dynamic calls to any service. So, for example, I can hard-code access to MySpace or I can dynamically find a service based on a String and the API will return a connection to that service for me. So, the basic coding structure would look similar to this:
Static Service Call
class MyOpenSocial
{
var $provider;
function MyOpenSocial( )
{
// create MySpace provider
$this->provider = new osapiMySpaceProvider();
}
}As you can see, this type of static call is very limited and now my class is restricted to the MySpace platform only. If I want to connect to another service, I need to write a new script.
Dynamic Service Call
class MyOpenSocial
{
var $provider;
function MyOpenSocial( $x )
{
// create storage instance
$storage = new osapiStorage();
// create provider
$this->provider = new osapiXrdsProvider( $x, $storage);
}
}This is fantastic. I can now use this code to create any connection to any platform that uses the Open Social API. All I have to do is send it the name of the service. I can now use one script for all my connections to all the platforms I want to interact with. This is something Facebook and Twitter cannot do.
So, what is the benefit? Well, as developers, we always need a way out. We always create our own APIs so we do not have to rely on 3rd party services. If your application connects to Twitter and doesn’t maintain its own database of the communications sent back and forth. Well, if Twitter suddenly calls it quits, you lose your customers. This is what we are trying to avoid.
We want to build scalable self-reliant services that connect to multiple platforms and Open Social is designed with this as its main purpose. Facebook on the other hand only cares about one thing… Facebook.



