To explain what RESTful API is, first we need to understand what an API is and why do we need it in general.
In basic terms, API (Application programming interface) is dedicated to transferring data to allow applications communication with one another. We seamlessly do API requests every day. When we use an application on our mobile phone or on our computers, the app connects to the internet and sends data to a server. At this point, server retrieves the data, interprets and performs necessary actions and sends it back to our devices. Now the application interprets the data and presents us with the information we requested in a readable way. The reason we need APIs are simple. Different applications want or need to use one another’s data and information. For example, food delivery application might require Google Maps data to improve their services. Or someone might request Jazz songs from Soundcloud to create statistics on their application. APIs let companies interchanging the information and provide you a way to query their applications easily.
Great real life analogy to API request is a restaurant with a menu of choices to order from, has waiters, and kitchen to prepare the orders. A Client or a customer orders food to the waiter. Waiter takes the order to the kitchen, where the actual food(request) is prepared. The kitchen prepares the order and gives it back to the waiter, who then returns the actual request to the client. Waiter in this analogy is a bridge or an API between client and server.
APIs have different formats. It could be returned as XML, HTML, YAML, and many others, however most common API format is JSON. JSON is Javascript Object Notation which basically looks like Javascript Object. It is easy for humans to read and write, and it is easy for machines to parse and generate.
Now are you wondering what RESTful API is? It is an architectural style and approach to communications often used in web services development. REST (representational state transfer) was created to make the API communications more organized and standardized just to make the whole process easy. The graph below shows how RESTful applications are responding to different HTTP requests for different links.
RESTful API explicitly takes advantage of HTTP methodologies defined by the RFC 2616 protocol. They use GET to retrieve a resource, PUT to change the state of or update a resource, POST to create that resource, and DELETE to remove it.
Finally, ever since Roy Fielding created this architectural style in 2000s, RESTful APIs are considered the backbone of the internet.
For further information please visit Source websites: