REST API, which stands for representational state transfer application programming interface. Some of the simplest questions that might come up when you’re first starting to understand REST API is, what is being represented exactly, what is a state, and what is being transferred. So here in the article, let’s look at all these words individually and learn what they all mean.
The word ‘representational’ means there is a transfer of representations of resources and the resources can be pretty much anything that can be named on the Internet like a list of users or a list of photos, comments, posts, articles, pages, videos, books, profiles, etc. To understand how exactly we get a representation of resources, you need to look at how everyone interacts with web pages, the client-server model, and the HTTP. Here’s the HTTP protocol:
Everytime you type a URL in a browser, you’re sending a request to the web server and the web server responds with a resource. What’s important to understand here is, everytime you type a URL in a browser or click on a webpage link, you’re sending a request for a specific resource or resources from a web server. And the web server responses and delivers the request your resource to your browser as in a formal web page or whatever format that the resource is in. The second important point to understand is that web server doesn’t actually deliver the resources. It doesn’t send you the database that it has, but rather a representation of that resource in a format that is readable, for example, HTML or image. Think of actual resources, physical things located on a web server database or stored a web server hard drive, and representations of those resources as copies in either readable format for human beings like HTML or image or easy-to-work-with formats for programmers like JSON and XML. It’s also helpful to think of the whole web as a bunch of resources. We always request the resource when clicking on a link or type in a URL, no wonder that URL stands for Uniform Resource Locator.
So what’s about the word ‘state’? Take an example, whenever I click a link, the application state changes and I am presented with another resource, which is a page with all the other content of that resource. And as I click through all these different pages, the application state keep changing from one state to the next. When the resource gets transferred from the web server, we send a request for the resource and we get a representation back and whatever formats the resources presented. This is what is meant by the word ‘transfer’. However, it can also refer to the transfer of the application state when we click on the next link and get transferred to another page.
So far, I have been used many tools to handle REST API Testing, some of them are really amazing, including Postman, Katalon Studio, JMeter, Rest-Assured. If you want to automate API testing but do not yet have a testing tool and do not have any financial support, I highly recommend Katalon Studio since this tool is a completely free full package of powerful features.
In case you want to learn more, here is a step-by-step tutorial about how to test REST API & RESTful web services with Katalon Studio https://testautomationresources.com/api-testing/rest-api-restful-web-services-testing/