Developing with REST APIs

REST APIs are something I am very excited about ! Right when I started to use the ‘Play Framework’ for developing web applications, I noticed the ease with which I was able to map the URL directly to my java methods. At that time I didn’t realize how Play! was mimicking the REST API or any web service for that matter.

I wanted to learn and use web services, for quite some time. I had read quite a few articles, that recommend developing UI which are based on Web Services. The whole objective of my scouring through the web, was to improve the way I did, UI Development. What I found was, Web Services give a lot of flexibility, and simplifies developing UI.

The advantage I see of using web services, is that I know what data I am getting and I am immediately thinking about how to show this information using the UI. There is a clear separation of concerns, when it comes to the User Interface and the Business Logic, and the UI developer just has to think of the data. I just love the JSON Data format, and using it with UI is just a breeze. And isn’t it great that REST Web Services deliver JSON.

The other advantage is that UI is just a part of your application, your services can be consumed by others and they don’t have to depend on your User Interface if it is not what they want. The Application is flexible in that way.

Rest isn’t the only way to do Web Services, but it is much cleaner than SOAP based Web Services. I consider XML really bloated when it comes to data. But it has quite a big advantage to JSON, as it is an inherent Document Structure, and neatly ordered. And with SOAP,  development is kinda ok, when you are using a good library for parsing data from an XML document.

REST uses basic HTTP commands like GET, PUT, DELETE & POST to perform the basic CRUD operations. And I could use the different commands to manage my domain objects in a inherently simple way. I discovered pretty late, that almost every great web site these days are exposing REST APIs for developers. Facebook, WordPress, Google and NetFlix are just the tip of the iceberg.

Imagine what you could do, when you pull information of all these sites. It is more than enough to create the next cool app with it. You don’t have to worry about the content anymore, you just have to worry about what the user wants to experience !

REST Resources:

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s