Captain Jack Sparrow on RESTful Web services
“I like it. Simple. Easy to remember.” The words of Captain Jack Sparrow. And this is exactly how I feel about RESTful API’s.
What is REST? The Wikipedia definition says:
“Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term was introduced in the doctoral dissertation on the web written in 2000 by Roy Fielding,[1] one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification, and has come into widespread use in the networking community.”
Do not let this put you off or confuse you! Lets look at a RESTful implementation to make things clearer. Lets look at YouTube’s RESTful API.
Lets say you want to write a PHP or Python or some script that gets your account details on YouTube and display them on a page.
All you need to do is to go fetch the output of a certain page and parse that output to get it working:
You read in the URL given by YouTube:
http://www.youtube.com/api2_rest?method=youtube.users.get_profile&
dev_id=YOUR_DEV_ID&user=YOUTUBE_USER_NAME
As you can see, this looks like a pretty standard link to a page in a site. Thats just it! It is! You can open this URL page in your browser. Obviously, YOUR_DEV_ID and YOUTUBE_USER_NAME should be replaced by the values you got from YouTube.
If all is ok, this “page” should return something like this:
<?xml version=”1.0″ encoding=”utf-8″?>
<ut_response status=”ok”>
<user_profile>
<first_name>YouTube</first_name>
<last_name>User</last_name>
<about_me>YouTube rocks!!</about_me>
<age>30</age>
<video_upload_count>7</video_upload_count>
…. and more ….
</user_profile>
</ut_response>
This looks just like XML, doesn’t it! Exactly. So you write your script to read the contents of the page that the given URL points to and parse this XML output it returns and do with it what you want to.
This is easily the easiest way of doing a web service you’ll come accross. Not only is it easy to consume the service, it is also easy to implement a web service this way!
Note, that there is a lot more to it. This is a simple, working example. I suggest you read all the Wikipedia page to get a better, more complete overview! You can however with this titbit of information, use the YouTube RESTful API!
technorati tags:RESTful, YouTube, API, webservices, REST
Blogged with Flock
3 Comments to "Captain Jack Sparrow on RESTful Web services"
Spit it out!
Programming, web development Stii
Recent Posts
- Afrigator Beta2.0 - Content and usability
- Afrigator Beta2.0 - Custom feature
- Afrigator Beta 2 - Tons of new stuff…
- Spammers offer nothing for R1 plus postage and packaging
- Bloody Stupid Johnson
- A really great music video!
- Facebook chat is not about replacing your IM, its about connecting with people in realtime.
- Vernon Koekemoer got R20 000 for his Vodacom ad. This is for you Wezzo!
- On Earth Day, I found an Arrowhead Flatworm!
- Follow your friends’ submissions on Muti
My Posse
- Jayx’s bloggy
- Gogo’s blog
- Go2 South Africa
- Stumble Upon
- Dave Duarte
- Wikipedia
- zlythern
- E Active
- Max Kaizen
- Tresblue
- Mike Stopforth
- RafiQ
- Muti.co.za
- Employmint
- Danette’s Bloggy!
- Thinking Machine
- White African
- kiefpiet.co.za
- Skuff’s World
- Top SA Blogs by muti.co.za
- Goozeberry
- Crossloop blog
- Crossloop
- Aquila Online
- Charl van Niekerk
- Derek Allard
- Code Igniter
- Carls
- Justin Hartman
- blik.co.za
- Stefano Sessa
- Uno de Waal
- Amplitude!
- bLaugh
- Tyler Reed
- Chris Rawlinson
- Stormhoek!
- 3am
- Mike Solomon
- Mobile Q and A
- Eric Edelstein
- Marc Forrest
- Imel Rautenbach
- Absolutewillie
- Vincent Maher
- Colin Daniels
- Groogle!
- Chilibean
- Paul Jacobson
- Ayelet
- Python Guru Neil
- Rails Guru Nic
- Beverley Merriman
- Miguel
- Nic Harrywhatshisname
- Chris iMod
- Geekrebel!
- Steven McD
- Belinda sweetheart!
- Henre Rossouw
- JPGeek
- Adventurous Mama!
- Foxinni
- Adii
- Charl Norman
- Bandwidthblog
- Jason Bagley
- Simon Botes
Filed in
- Afrigator (23)
- ajax (9)
- API (2)
- Apple stuff (10)
- Blogging (23)
- browsers (5)
- Business (27)
- Code Igniter (8)
- firefox (8)
- flock (14)
- Funnies (72)
- GeekDinner! (18)
- General and sometimes Rants (45)
- Go2SA (2)
- ideas 2.0 (13)
- javascript (12)
- Kick-ass Tools (30)
- Linux (4)
- Marketing (25)
- moo.ajax (4)
- mootools (6)
- Open Source (10)
- Programming (32)
- C# (1)
- PHP (13)
- Python (9)
- Ruby (on Rails) (9)
- RSS (5)
- Semantic Web (30)
- Social Web (57)
- Software Development (15)
- South Africa (31)
- Tagging (6)
- Techie stuff (22)
- Tshirts (2)
- Tutorials (42)
- Blogging (17)
- Flocking (6)
- muti.co.za (13)
- Web 2.0 (71)
- web development (20)
Past Stuff
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006















[...] more information in the Geek Dinner, please feel free to contact Stii or myself or have a squize at the Geek Dinner [...]
[...] just read an article titled Captain Jack Sparrow on RESTful Web services. Although I think the article is good in explaining the simplicity of web services to the masses, [...]
[...] night Neville released a first draft of a REST API for Muti! POX, just as I like it… So I’m quite privileged and honoured to be one of the [...]