“Everyone’s got an API. I want mine!”

First of all, for the record, I didn’t say “Everyone’s got an API. I want mine!”; it’s just the title of this post. Secondly, that is the wrong frame of mine for anyone to have in anything because it’s not good to go into creating/building something if you are primarily motivated to be “second best.” I shouldn’t divert from the main topic here. I’m writing to shed some light on some API business. I’m mainly concerned about the REST API Web Service because it is by far the most popular and useful Web Service out there. This Web service is very popular among JavaScript programmers because JSON is one of the formats by which REST API’s transfer/relay state. SOAP does not support JSON!

Some people might have heard about the SOAP and REST Web Services but might be puzzled on what services these two really provide and which to choose to solve some specific problems.  SOAP stands for Simple Object Access Protocol while REST stands for Representational State Transfer. So that I don’t bore you with so many technical details as would some others, I would say that the main pragmatic difference between these two is that REST as a service ships in more versatile formats like JSON, XML, YAML (sometimes) while XML is the message format that SOAP ships in and depends on. Applications that implement a RESTful architecture are usually said to be RESTful.

Who uses REST and why do people use it? A lot of companies! All of Yahoo’s web services use REST, including Flickr. Del.icio.us API uses it, pubsub, bloglines, technorati, and both eBay, and Amazon have web services for REST. Here are the defining qualities that make REST stand out:

  • Lightweight – excludes much of the redundancy that accompanies SOAP.
  • Easy to build – no special toolkits required.

Now let’s get to the real business: How do you build a REST API (I hope you are convinced enough that REST is easier to produce and use than SOAP). I could write a bunch of pages on how to write a REST API using WSDL (Web Services Description Language) or a server-side language like PHP or Ruby but would be reinventing the wheel by doing so. I have a list of tutorials that I believe people can benefit from just as I did and learn how to create their own REST API’s. Please remember that when following these tutorials, you should take note of third-party libraries like SoapServer in PHP. It is very tedious, slow, and not wise to start building your own library from ground up without using any helper libraries. Take a look at this list of resources on API creation and development:

Ok, that’s it folks! Follow more than one of these tutorials (make sure you listen to the google tech video; it’s priceless!).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s