Showing posts with label REST. Show all posts
Showing posts with label REST. Show all posts

Tuesday, April 15, 2008

Access RESTful API in 2 LOC

Today I was playing with json-lib and FriendFeed API in Groovy console and was able to fetch feed's JSON representation and do a simple result filtering in 2 lines of code! So, for example, here are all my recent twitter entries (filtered from all the other content e.g. different services like flickr, amazon, etc.):


import net.sf.json.*

def friendFeedJsonResponse = new URL('http://friendfeed.com/api/feed/user/dima767').text
JSONObject.fromObject(friendFeedJsonResponse).entries.
findAll { it.service.id == 'twitter' }.
each { println it.title }
I know it is a very simple example, but IMO, with an 'expressiveness' and 'compactness' of Groovy, in the majority of cases, there is no need for a 'wrapper' library and various web APIs could be used 'as is'

Later...

Monday, May 28, 2007

RESTful web services - the book

Few days ago I've received a copy of the RESTful web services book. As far as I understand, this is the very first comprehensive text on the subject matter. Since REST seems to be the "hot" topic these days, the book immediately drew my attention. I bought it, so I could learn in-depth about this topic.

I just started reading it and all I could say that the book is excellent (IMO). Authors give "no bullshit" explanations about the "architecture of the world wide web", what are the advantages of using simple, yet powerful and ubiquitous architecture of HTTP to deliver lightweight services. They also define some architectural patterns (they call it ROA for Resource Oriented Architecture), show the comparison between "The big web services" (WS-*) and give plenty of examples (in Ruby, which is actually fine with me, since Ruby is a very easy to read and understand language). The examples include real world RESTful services from Amazon (S3 storage service), the various incarnations of the Atom Publishing Protocol, Google Maps, and del.icio.us.

I like the foreword by DHH:

"A renaissance of HTTP appreciation is building and, under the banner of REST, shows a credible alternative to what the merchants of complexity are trying to ram down everyone's throats; a simple set of principles that every day developers can use to connect applications in a style native to the Web... Every developer working with the Web needs to read this book"

As I learn more about RESTful principles, I start to appreciate it more and more and favor it over the "Big web services".

Later...