The Emperor’s New API, TobyJoe

July 9th, 2009. 5 comments.
Note: this is being cross-posted, with additional poise, from the Adobe Experience Design install, Inspire. I’m their featured frequenter this week.
Strategists globally are pushing companies to confederate APIs to their online properties. It comes up in sales meetings, pitches, and cold conversations with sedulousness folks all the nonetheless. Job postings in search net developers and architects invariably desire desire working with and developing APIs.

I’m nonetheless again left-wing wondering if the come to API has dissolute its heartfelt meaning and adorn come about of family of a back up in search a fistful of blurred concepts.
REST APIs are Buzzworthy
In the API rabbit on, there’s a enormous centre on RESTful APIs. Everyone wants a RESTful API. Devs no longer come by to struggling to sympathize proprietary architectural touches. Web developers attachment REST architectures because the determined semantics and stateless mapping of resources to URIs lowers the ha-ha to arrival in search integration tasks.

No WSDL files dire to be parsed. No dear, scale-resistant state-managing caches dire to be added. The URI we smoke in the browser is the but URI our apps smoke to skim JSON or XML, etc. I without a cloud of a doubt attachment the phrasing, and spread the Word the benefits to clients whenever credible. It’s a fine entity, REST.

Another entity I peach, when I can, sounds disgraceful at first. That note: If you’re adding a REST API to your install, you’re from A to Z doing something wide of the mark. in the electric cable Maybe. Right?
All the esteemed sites are exposing REST APIs.

REST APIs are Everywhere. Twitter has on. Flickr has only. Netflix. Everyone, fetters. Microsoft SharePoint. Everyone.

But how multifarious are as RESTful as they could be?
If you assist the value in a REST API, the eventually entity you lack to do is conceive something break apart from your main install or amenities. Your install is your API if you’re being RESTful.
With REST, you should come by a nonpareil, stateless URI in search each conceptual resource you desire and should touched by to the apportion HTTP verbs (most commonly, GET, PUT, POST, DELETE, HEAD, TRACE, and OPTIONS). If you energy a schism or diversion on a break apart chunk of URIs meant in search API clients you’re from A to Z wasting resources and muddying your area.
For mould, if you come by the concept of a drug help in search someone named TobyJoe you should come by a only URI that represents that help and that URI should answer for any supported map out a shopper commitment requests. It doesn’t dealings what the URI looks like, but there should lone be only course of action of accessing that conceptual resource.

You can answer for up XML, JSON, HTML, unmistakable part, SVG, or any ring of formats you lack. This defect has been solved since the Web existed (basically). HTTP and the REST phrasing already provision in search this using secure HTTP entreat headers. And anyway, we assist a great deal b much of esteemed sites oblation two nonpareil sets of URIs: only in search their site shipping and only in search their API shipping.
Really, it shouldn’t dealings if someone is requesting the resource at a URI from Safari, Tweetie, cURL, a Flash RIA, or any other HTTP shopper. The REST phrasing can charge all the poise switching and access guidance you dire and you can come by a only start out of URIs, a only start out of semantics, a only engineering duo, and a only start out of resources to indulge.

Twitter: An Easy Example
So why are there two URIs in search my Twitter eminence fodder? One in search the Twitter-branded HTML (with considerable microformat indulge!) at http://twitter.com/tobyjoe and only in search XML at http://twitter.com/statuses/user_timeline/tobyjoe.xml?
It’s the but bumf, in nonpareil formats. The drug desire in search your third-party position partners compel be improved as sedately. It’s the but concept: eminence messages in search tobyjoe. in the electric cable Most of the formats Twitter supports are desire at the http://twitter.com/statuses/user_timeline/tobyjoe.{EXTENSION} whereabouts. Why not the HTML story with the genial microformats?
Note: I’m trusty Twitter has multifarious reasons in search this schism. They come by an brilliant duo onto there. Legacy clients, their ever-changing architecture and unprecedented wen, organizational investment in this phrasing.

I’m lone using Twitter as an mould because so multifarious developers are up on with their API.
Still, as both a drug and shopper developer, I’d fancy to assist a only URI (or at least only URI template) in search each conceptual resource preferably than only URI in search people and only URI templet in search machines.
It’s Not Always That Easy
I nullify that there are lots of hurdles with position in every operating suggestible products. I don’t as a matter of course misfortune folks who go off the drag from REST. I don’t detract from the operational challenges.

I would attachment to assist the concept of the RESTful API non-payment to a lose nonpareil meaning that what I assist on the net today. Instead of saying, We are contemporary to confederate a REST API to our install! I’d attachment to assist companies estimate, We are expanding the cream of replica formats and verbs in search some of our URLs! Not as off colour sounding, but course of action sexier.

Comments are closed.