Hey Developer, how long have you been in your Computer Science profession ? Nevermind, but have you ever heard of Rest API's? I'm sure you have no matter what language you use. But do you know what are these rest API's ? Don't worry today we'll be discussing about Rest API - Explained in an Easy, Quick and Simple Way. Oh, and do tell me how long have you been in this coding profession in the comment section below 🙌.
Rest API
Let me explain with the help of an example. Suppose you want to make a weather application. Now in a weather app you can see that different locations have different temperatures and that temperature changes every now and then.
So, how to we get such huge amount of data from?
For that we have servers or clouds located around the globe. So when you use the weather app and try to search for weather of a location you will send a Request to the server that you want the temperature of XYZ location and then the server will Respond to your query.
But then how do you generate that data from server?
For that you will have to use a servlet. So now a client will send you the data and the servlet will respond you with the data.
But what will the servlet return to the client?
The servlet will return you the data in form of XML or JSON format (based on your requirement). But to get data from servlet you will have to write some bulky code and to make remove this bulky code we use Rest API. So what if you just have to create an object at server side and return the values associated with it or we can say you want to return just the state of the object.
Now whenever we use internet we use CURD operations ( C-Create U-Update R-Read D-Delete) . We CREATE the resource we UPDATE the resource we READ the resource and we DELETE the resource. So to perform these CURD operations we use Http methods like POST, GET, PUT,DELETE. So by using these operations we can perform a CURD operation. And that's how the Rest API works.
Use below Code to embed this Infographic:
This was all about the basics of Rest API. I hope you enjoyed reading.
Here all content so useful and helpful for beginner and experience both.This site is so amazing, This sites gives good knowledge of rest-api,This is very helpful for me.
ReplyDeletevery nice information, Interior Design Services in bangalore
ReplyDelete