Hey everyone welcomes back, Today we’re gonna learn what is REST and RESTful API you probably heard the word REST API and restful API in web development and then you will have a few questions about it just like what is REST API what is the use of it what is restful API and so on.
So if you have this question in your mind don’t worry in this tutorial I will solve all of them in a few minutes but before we get started to make sure you have a solid understanding of API recently I wrote a blog on what is API with an example so don’t forget to read that first before you move on with this tutorial
Now if you already know what is API then it is very easy to understand what is REST API before we understand what is REST API we need to first know about bodies wave services now let’s talk about first 40s web services in the modern-day business application we use a variety of programming platforms to develop web-based applications some application may be developed with a java author in Dotnet while some other in angularJS node.js and so on
Since they are built using different development languages it becomes really difficult to ensure accurate communication between applications this is where web services come in web services provide a common platform that allows multiple applications built on the various programming language to have the ability to communicate with each other
So using web services you can communicate with different languages right now there are two types of web services and web services which are also known as a simple object access protocol and the second one is restful web service we mainly focus on based API so we will understand the second one and learn forty’s restful web services so fist we need to understand what is REST representation state transfer it is a set of rules that developer follows when they create their API in simple words REST is an architecture to create restful services
For example: let’s say you are trying to find funny videos on youtube you open YOUTUBE but type funny video into the search field hit enter and you see all these top funny videos the rest API work in a similar way you search for something and you will get a list result back from the service you are requesting in simple words request is just a pattern for making a standard pattern for naming resources that service provided.
For example: in Gmail API example you can interact with your email draft to do this google follows the rest pattern by giving you a URL that looks like
This is this URL you can see you have your HTTP method the service name which is Google API clam and then you have your Gmail user ID and the doc so using this URL you can get your drop emails almost always API’s use HTTP they don’t have to but most of them use HTTP request rest basically works on HTTP web layer and use the key verbs to work with resources on the services we can write post requests to create resources on the server
Get requests to retry the resources from the server Put request to change or update the resources or we can call delete request to remove or delete resources from the server
Now le’ ts say if you want to get the list of the draft so you just send the get request to that URL if you wanted to create the draft you can send the post request to that URL if you wanted to update the draft you can say the post request and if you wanted to delete the wrap you can send delete requests to that URL right because you are using rest pattern for there API’s you can easily see the pattern for listing creating reading updating and deleting labels it just at a different URL rest is just a pattern for making a PRS right ??
And using this API you can access resources like image post videos text content and so on so using API you request something it may be a video or image or a list of the user and you can request it using URL now the next question comes in what is a RESTful API a service which is built on rest architecture is called restful service in simple word developer who creates API using this pattern or you can say this API known as RESTful API so basically if any API follows the REST pattern we can call it where API now once you know that what is RESTful API the next question comes in what is the use of RESTful API
The RESTful API enables the web application that built on various programming languages to communicate with each other it also helped us with the help of restful resources the web application can reside on the different environment some could be on Windows and other could be on Linux but in the end, no matter what the involvement is the end result should always be the same that they should be able to talk to each other restful web services offer this flexibility to applications built on various programming languages and platform to talk to each other so I hope you understand 40 is waste what is restful API and why should we use it if you have any question you can like me in the comment section