A bit on RESTful webservices

February 10, 2009

Today I was put on the spot and asked to explain REST as it pertains to Web Services, unfortunately I found that I could not articulate that which I know and ended up basically flubbing the opportunity. Uggh, I was so angry at myself.

The truth is that REST is not easy to use and/or explain. Yeah, its simple but its not easy, in fact its hard. So I thought to avoid that particularly uncomfortable situation recurring that I should come up with some basic points to explain it, I shall call them Conrad’s 4 basic cornerstones of RESTful Web Services. Those reading here should also see it as an opportunity to chime in and help by providing feedback as I think there are a lot of people that THINK they understand REST but don’t really grok and I am certainly not excluded in that statement. I am not going to go into the benefits and what not, read wikipedia for that. This is purely some notes on the very basic principles.

Conrad’s 4 Cornerstones of RESTful Web Services (HTTP)

REST = Representational State Transfer

  1. The service exposes application state and interaction as resources that can be represented (sic) as a unique URI over HTTP
  2. Resources are manipulated (maybe not the right word) through a uniform interface, these are POST, GET, PUT and DELETE verbs
  3. The service is stateless.
  4. The service is strictly client-server

Right I believe that is enough for my purposes, there are some other bits around Caching and Layering, mime types and response codes that my points don’t cover but IMHO we are ok as HTTP takes care of that for us to some extend and the rest are less crucial to grokking the concept and thus removed for simplicity.  (opinions?)

What does the URI address for the resource look like?
A simple example:
Here we are addressing a specific resource in the user collection .. though we are not expressing any intent as we are not providing a verb.

Throw a verb in the mix:
GET http://mysite.com/api/user/1
Ah, now we are getting somewhere we want to retrieve the data for that specific resource.


DELETE http://mysite.com/api/user/1
I would like to delete the addressed resource..

Similarly POST would create a new user (drop the resource identifier “1” here) and PUT would alter and replace the resource.

Thus the verbs loosly map as follows for out purposes:

Responses on these actions will return status codes, another handy HTTP freeby that REST can use e.g. 200 OK’s and 404 Not Found etc..

To state or not to state?

Um REST is stateless and the so-called gray area of using cookies for auth purposes is not gray, its broken. Just deal with the fact that your are not 100% compliant and leave that there.  Alternatively look at Amazons Rest Auth implementation which operates via headers sent to and fro. Also adding the session identifier to every URL is not valid as this breaks the uniqueness of the resources’ address as each user will utilise a different URI to address THE SAME resource!

Ok I am tired now, I still want to talk about using RESTlike URL’s in your web application/site (as opposed to API’s for webservices) as I have done in the past which raises issues such as the difficulties of using PUT and DELETE via browser forms often addressed by repurposing the POST method somewhat .. maybe subject matter for a next time.

PS whats up with Facebooks so-called RESTlike API?

Methods like admin.getAllocation etc??? Looks more like RPCLike what with method names getting sent in the requests? Use of HTTP and XML does not a REST service make!

Well, I dunno. Apparently it’s up in the air at the moment according to google.

But Dewald Botha is trying to claim the fame for entirely selfish reasons (something about a SEO prize??). For a brief moment he pipped the Brad Fallon and the Justin Hartman (no links, cause that’s not fair to Dewald, and that makes him a sad panda apparently)

Link to the bloody oke if you care, he said he would hurt me if I don’t ask (but I am sure you don’t care about either point anyway)

Oh and visit his stupid website http://coolestguyontheinternet.com/ because he is slipping down the ranking quick because he had illegal pages up at the wikipedia and the hubpages and they finally caught wind.

If anything it should be funny to see if he wins, in which cause he may buy us all a beer, but I doubt it because he is also a poor panda getting married on top of being a sad panda, which has nothing to do with the panda in Kung Fu panda but that panda was a funny panda, so I just wanted to mention it.

mobile-projectorEvery day on the schoolyard a familiar scenario plays out where a group of kids all huddle around someone with a cellphone, pumping out the latest and greatest MP3 over the built in speaker. These kids can also be seen on their bicycles playing the same songs, walking in the mall playing the same song (loudly, so everyone hears) etc, etc.

The next big thing that all the mobile manufacturers are scrambling for seems to be the inclusion of a teeny tiny data projector, built right into the phone. No doubt this is originally meant for photo sharing and business purposes, but I can see something else evolving out of it. Perhaps this will be what the kids on the playground latch onto next?

Marketers, keep an eye out on this one, mobile video may become the holy grail for embedded advertising in ways we never thought of. The small screen has become untethered.

I was a suffering from caffiene withdrawal when I saw this post of a Blow Controlled mobile phone, and the following crazy scenario played through my head, this is what I would have blogged if it was all true (which it’s not):

[Start of silly fictitious post here …]

Amazing, finally someone has savvied to the idea of a blow controlled cellphone. Ever since watching fear and loathing, I knew there was more to a bit of blow than meets the eye.


Meet [insert manufacturer here] “blow-controlled” mobile.

I mean, who needs anything more than a really basic phone anyways. The coolness factor should an could always be influenced by providing the user with appropriate quantities of blow during purchase and carefully regulating the users intake when accessing features like the phonebook and looking for a “multiple recipient” feature etc.

At last, someone has now released that exact phone. Brilliant. Much in the same way as Apple may be laceing their packaging with crack so that people will continually buy their products once buying the first, no matter how bad it is, someone has realised that introducing a notable narcotic in your product offering will sweeten the deal just so much more, while simultaneously easing product development. Almost makes that 2 year Vodacom Weekender contract (with the useless weekend minutes) more bearable.

[End of silly fictitious post here …]


7eb7f53a498717eb400x400No folks sorry to disappoint but this is fact an actual device made by Pantech as featured by engadget mobile and as crazy as it sounds, this device is really controlled by the “wind” or rather the action of you gently blowing into the microphone may be used to adjust things like brightness, and volume..


Disclaimer: The fact and opinions expressed on this blog are completely a figment of the authors distorted mind, and can in no way be traced back to anything correlating with any one entity or event in reallife ever. This is a work of fiction and is there only as a parody/bit of a joke and will be gladly removed at the request of any party directly affected by it.

Jack’s Back!

February 3, 2009

Well for the umpteenth time anyhow. No this is just a note that I will be attempting to post on here again, after the tumblr blog turned out to be a horrible failure, apart from the twitter feed integration. But I may feel the need to write something proper from time to time again …