“Do you know something about API or Rest-API?” After evaluating my Django knowledge, this was the first question, the guy on the other side of the phone asked to me. It was a call from a just starting startup.

After getting rejected in 5–6 internships in internshala, getting a call like this was a surprise to me. Thank god, I had some basic knowledge about API.

Let’s understand, what is an API?

API(Application Program Interface)

Different applications like android apps or desktop apps or even Operating System are built in a different way. They have different languages, have different structure and even requires different platforms to work on. With so much of difference in them, how will the two systems interact with each other?

API working as translator

Consider your phone and the Instagram app in your phone. One is an OS and the other is an App which is designed to get easily downloaded and used in any OS. They both are different systems. They both are managed by different companies. They both are written in different languages and thus they are not alike. Working of instagram on android needs a request to be sent to the app to perform operations. How can a OS interact with the app?

There comes the role of API who works as a translator between the two systems. Its basic job is to convert the message sent by one system into the language that can be understand by other system.

An API is an application programming interface. It is a set of rules that allow programs to talk to each other.

REST-API (Representational State Transfer-API)

Communication to the systems usually means, communication to their database. In other words, it needs a request to be sent over a network to the respective server in order to get the data from the server. The term web API generally refers to both sides of computer systems communicating over a network: the API services offered by a server, as well as the API offered by the client such as a web browser.

The server-side portion of the web API is a programmatic interface to a defined request-response message system, and is typically referred to as the Web Service. There are several design models for web services like: SOAP, XML-RPC and JSON-RPC. Other than REST, these API frameworks are complex and follow strict messaging rules.

REST is the simplest of all the architectures. It follows the principle of CRUD(Create-Retrieve-Update-Delete). It means, REST has categorized the requests and responses sent over the HTTP into four main groups and thus simplifies the operation. Performing the CRUD operation has become easy through the introduction of the REST API framework which is can be done easily by putting GET, POST, PATCH and DELETE before the HTTP request.

REST API also has the advantage of accepting almost all types of contents which usually is not allowed in SOAP. REST allows transfer of XML as well as JSON data formats.

REST is stateless, meaning the client request should contain all the information necessary to respond to a request. In other words, it should be possible to make two or more HTTP requests in any order and the same responses will be received.

This was just a short intro of API and REST API which I told to my mentor under whom I was going to work during my internship.

But is it possible to create a REST API using Django framework? We’ll see in the next part.

Django developer | ML Enthusiast | Reader