RESTful API for Beginners

Luka
Luka
Oct 27, 2019 · 3 min read

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.

Source: https://www.softwaretestingmaterial.com/api-testing/

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.

Source: https://idratherbewriting.com/learnapidoc/docapis_doc_sample_responses_and_schema.html

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.

Source: https://chelseatroy.com/2018/08/10/api-design-part-2-the-arrival-of-rest/

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:

More From Medium

Also tagged Coding

Also tagged API

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade