RESTful web services for beginners

This article is for beginners who are starting their way into RESTful web services testing. Let’s start with the very basic question. What is a web service? Though we do hear the term web services very often in the industry, and though we don’t really admit to it, but many of us didn’t know until recently what a web service is actually OR more to the point what is meant by a RESTful web service.

I will give a very basic explanation. We go to a shop to buy some stuff. We tell the shopkeeper that this is the stuff we need. The shopkeeper in turn responds to us with the list of goods we asked for. Also, there is some goods from the list that we asked that may not be available at the shop. So, for those goods, he lets us know that these items are not available. We can consider a web service to be the same shopkeeper who gives us the list of items we want to buy and lets us know that what items are not available.

Now let’s get into the more technical terms. When we work on our computer, say we open a documenting application to create a new document OR just read an existing document. The computer responds with opening up that document on the machine so we can write/read to that document. Here is service provider is a computer. In case of a web service, the service provider is a web server. In a typical client/server application, the web service is the means of accessing information/resources that the web server intends to provide to its clients. Here the communication between the client and server happens over a network. This is achieved by certain collections of protocols and standards for exchanging information between 2 devices.

The most common examples of web services are SOAP (Simple Object Access Protocol). SOAP is the W3C standard of communication over the web. In the core of SOAP based communication is the WSDL (Web Services Description Language). WSDL is the XML document format which contains the information like method name, parameters and how to access the service. This is done using UDDI (Universal Description Discovery and Integration) which is again the standard XML framework for integrating web services.

So, what are RESTful web services? REST is an architectural style and not a protocol. It makes use of URI (Uniform Resource Identifier) to locate the resources in the form of data or functionality OR data + functionality on the web. It permits different data formats like plaintext, JSON, XML and HTML.

Nowadays with the advent of Cloud, more and more companies are moving their applications to cloud with service providers like Microsoft Azure, AWS etc. So, the services that these applications offer are provided via REST based API calls as the main interface of communication between the client and the application residing on the cloud. REST uses features of the HTTP protocol in order to perform create, read, update and delete operations. REST based architecture has several additional advantages:

  • It is stateless. The server doesn’t store any data related to the information asked by a given client. It can even serve more than one client at one time and every single request is treated as an independent/new request totally un-related to the previous one. Caching can be implemented to overcome the nature of statelessness.
  • They are very easily deployable in different types of environments whether Windows or UNIX and can be coded in a variety of languages.
  • RESTful services are fast because there is no extra payload travelling over the network that eats up the network bandwidth.

The core of the RESTful web service is the URI. This is the HTTP URL followed by the name of the resource that is supposed to provide a service to clients. REST methods can be broadly categorised as follows:

  • GET — To read data on the server.
  • POST — To add a new record of data on the server database and for authentication purpose.
  • DELETE — To delete a record from the server.
  • PUT — To update the details of a given record on the server.
  • OPTIONS — To list the type of operations supported by a resource.
  • HEAD — A type of GET request that returns additional information about the resource.

Please do let me know of any questions and suggestions and I would be glad to get back to you.

Software QA and Development Professional with over 11 years of experience. Writer and technophile.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store