Many developers heard/use/implement/develop RESTful web services daily basis including myself. It seems likely that we all know what it is and how it works. However, if we ask ourselves why we are using it, what would be your answer?
My answer to this question is this:
To make *services* more sense.
We all know that RESTful web services utilizes http methods such as GET, POST, PUT, and DELETE. Most commonly used methods to me are GET and POST. And technical aspects of discussion can keep going. However, the question is how we can utilize RESTful web services and how we can make it so that other developers can consume them in easy way? Eventually RESTful web services is for openness. Facebook opens up their RESTful API so that other developers or 3rd party application of facebook can pull up information on users or something like that.
With RESTful API, it is *possible* that you can organize calls.
Let’s look at this imaginable API path for getting a particular movie info.
http://RESTfulAPIHost:Port/movie/
By just looking at the API path, you can take a good guess of what it might return to you. And then after that, you naturally think ahead and append movies name to it.
http://RESTfulAPIHost:Port/movie/dark-knight/
Looking at the API path, I would naturally think that I could expect movie information for the movie “Dark Knight”. This natural thought process leads to more details API paths like these:
http://RESTfulAPIHost:Port/movie/dark-knight/actors/
http://RESTfulAPIHost:Port/movie/dark-knight/credits/
http://RESTfulAPIHost:Port/movie/dark-knight/showtimes/