The Object Network: Making Mashups Easy

This guest post comes from Duncan Cragg a consultant, writer, speaker and 'coding architect' specialising in REST/ JSON Integration at ThoughtWorks (UK).

You may have seen the statistics and chart on this site showing that the number of APIs is taking off like crazy. There is clearly an enormous and increasing demand for data. This is undoubtedly a buzzing and exciting time to be in APIs right now.

But, look at a similar chart for the growth of the Web itself. Now you may start to wonder "what's so different this time?"

Common Formats, Shared and Re-used Code

The difference is clear and simple: the Web was built on the kind of common protocols and formats that allowed re-use and sharing of code. That, combined with the network effects of interlinking, and the growth of the Web was stratospheric.

In short, my page looks much like your page - and because of that, you can link to me, because the client code that understands your page also understands mine.

Take a look at typical APIs and see if that's true there. No, every API is different, each one uses HTTP slightly differently and returns JSON in different formats.

The Object Network

So that's what the Object Network sets out to fix.

Imagine if each API followed the same patterns and conventions, and even the same JSON formats. Imagine if those formats allowed you to link, not just to data from your own API, but between APIs, too.

The Object Network offers the promise of linked-up JSON in common formats. This will allow easier sharing, mashing and caching of data and allow client and server code to be shared and re-used.

In short, my JSON looks much like your JSON - and because of that, you can link to me, because the client code that understands your JSON also understands mine.

Which could trigger a new stratospheric ramp-up in API growth.

Formats for Common Stuff

The Object Network will offer JSON formats representing typical Web and mobile data such as: contact information, calendar events, news, article and message feeds, media metadata, comments and reviews, products, etc. All able to be put into lists or collections. All able to be linked up into a global network of objects.

We'll start with the most common stuff you get from APIs, then head out into the long tail, with help from the people that generate each kind of data, plus borrowing from existing standards and formats, such as Microdata.

APIs Made Easy

My vision is that, if you publish to the Object Network, apart from joining a community of software developers and data publishers, you will save the effort of working out how to design your API; you would just use the pre-defined protocols and formats.

It can also extend the reach of your data, by being accessible to client code that was there before you. And if you ever needed to replicate data from other sources before, maybe now you won't have to as you could just link to it directly.

Of course, it's not only client code that can be shared and re-used. If we're all creating the same JSON formats, there will be quite some code sharing on the server side, too, through frameworks and libraries. Maybe people will publish adaptors for various Back-end systems that can expose their data into the Object Network.

Mashups Made Easy

Looking around ProgrammableWeb, it seems that there are several types of API mashup - for example:

  • plotting data from an API on a map
  • mixing up widgets in a page, sourced by multiple APIs
  • merging lists of data from multiple APIs: like news items
  • taking data from one source to drive queries into another

Currently, every time you make a mashup like these, you have to learn one or more APIs and write dedicated code to work with them.

Wouldn't mashing-up APIs be so much more productive and satisfying if you were able to use the clean, stable JSON of the Object Network?

But hold on - if these API sources were Object Network sources, then some of the mashup work could be done already.

For example, surely a generic client Library could recognise contact JSON from any source, and offer to plot it on a map? It's the least we'd expect.

Take the example of mixing up widgets in a page, sourced by multiple APIs. What if I create a list of links to Object Network data objects: a weather object, a news ticker, a couple of contacts, an event, some photos?

If I just display that using generic client code, then I can have a single page full of updating widgets with about ten minutes work.

Further, if lists of data from multiple sources already had the same format, we'd only have to splice them together to tick off another one of those mashup types.

Lastly, in the Object Network we expect data to arrive already full of links to other related data. So most of the time we wouldn't even need to take strings from one data source to query another. The link to that second API would already be in place.

And if the link were not there, having standard query and response formats is going to make that mashup easy enough anyway.

Get Mashing in the Object Network

So, follow the blog series and join the Object Network Google Group to be part of the discussion around formats and protocols, and client and server software.

Then start publishing into the global Object Network.

It's pretty easy, even using the server Stack you're already familiar with: just use Object Network JSON templates, drop in the links and follow some simple conventions around HTTP, as I explain on the blog.

If you've got JavaScript skills, then come along and contribute to the generic client library and demo viewer I'm working on. You know, the one that offers to plot contacts on a map.

(Note to Javascript developers: I would like it to offer nested rendering and navigation through linked objects with built-in on- and off-line and pre- cacheing. It should detect JSON object updates across multiple sites using CORS and ETags. It also has to run on Node.js for server-side rendering.)

If you're an app developer, for Web or Mobile, then once there's useful stuff in the Object Network, you'll be able to start writing your apps and mashups based on that Javascript library code.

Be sure to read the next Tools article: API Billionaire Adds Author Extraction Service