Before diving in to implementing part first lets talk about the topic of this post, what is a RESTful web service? I will give a simple explanation on what is a web service and what is a RESTful web service. Please ignore the following chapters which describes these two if you already know what is a RESTful web service. For those who do not know or have a little understanding feel free to continue on reading. Let’s first dive in to the part ‘what is a web service?’ A web service is any piece of software that makes itself available over the Internet. So this service is accessible to other programs via the Internet. By programs I meant computer programs since humans rarely use web services directly, and hence they are written not targeting humans . As an example when you are browsing this blog post the browser is using many web services provided by WordPress in order to show you the content. You can view these web services that are being used by the browser by opening the developer console (F12 or mouse right click and Inspect Element) and going to the network tab. You will be able to see lot of requests with GET methods that have been used. So what is a GET method? that is for the next chapter.
So let’s dive in to the next question, ‘what is a RESTful web service?’ REST known as Representational State Transfer is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. So REST is one of the architectures that can be used for creating web services. So when we create a web service using REST architecture it becomes a RESTful web service. Before REST came in to the play the main architecture for creating web services was SOAP (Simple Object Access Protocol). REST was introduced in order to overcome the disadvantages of SOAP. Following table compares these two architectures.
Written By : Janitha Tennakoon, Software Engineer, 99X Technology