What is a REST API and how does it work?

Introduction to API

Kaveen Laksitha
MS Club of SLIIT
Published in
3 min readJul 30, 2021

--

API… I think you heard this word a lot. But maybe you don’t know what it is and want to know about it. When I heard it for the first time, I was also had eager to know what is it. So In this article, I’ll try to explain the concept behind API in a simple way as I got it.

What is an API?

First talk about what actually is an API. API stands for “Application Programming Interface”. An API is essentially a set of rules that allows two applications to talk to each other. In a simple way, API is the messenger that takes your request and delivers it to the provider and delivers back the response of the provider to you. It acts as a communication bridge between the client application and server application.

Process of API

Let’s take a simple example to explain components and the process of an API.

Figure 01: Process of API(example)

Imagine the process happening when you purchasing some food from your favorite fast food outlet. You visit the outlet and place the order through the cashier. Then cashier takes your order to the kitchen. After your order is ready, the cashier brings back the food whatever you ordered.

When we use that example to explain the components and process of an API, the person who is placing an order is acting as the client or the application. The kitchen where process your request or the order and return the order acts as the server-side. Cashier of the outlet act as the API who takes your order and gives back the order to your request.

Figure 02: Process of API

A little bit more about API

When it comes to programming, communication between the client and the server is done using formats called “JSON” and “XML”. The usage of them depends on the API type. If you don’t know about JSON and XML, you can get an idea about JSON by visiting this link, and by visiting this link you can get an idea about XML.

There are some basic request methods that can be made with API.

1.GET — Retrieve data from a server at the specified resource

2.POST — Create a resource

3.PUT — Update or create a resource

4.PATCH — Only apply partial modifications to the resource

5.DELETE — It really does what it looks like ):

API plays an important role when it comes to software development. Software developers can use available APIs in their development process, instead of coding from the scratch. This leads to saving time on writing new programs while speeding up the development process.

You can learn more about APIs from here.

--

--

Kaveen Laksitha
MS Club of SLIIT

Undergraduate of Sri Lanka Institute of Information Technology