Theoretical Aspects of API
Tags: webdev, programming, api, rest
Published: 2023-01-25 14:06:19

API is an acronym that stands for Application Programming Interface. It is a collection of communication protocols used by various applications to communicate between them. A programmer can make use of various API tools to make its program easier and simpler. Thus, in simple terms it acts as a bridge between two programs or applications to handle information and resources.

**Real-life example of API**

Let us take an example of when we are searching for a movie on a website like Netflix or something. We select the category of the movie and then all the movies are displayed on our screen for the genre. Well, this is all because our application/ device communicated and exchanged data with another application/program which is called server. Now, this server selects all the movies that suits the genre we selected, and sends them from the database to our screen.


![image1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lprukybrkm2iwmqofbc5.png)

**Types of APIs**

**Web APIs** - Web APIs are the apis which helps all the softwares and applications running on the web and they are easily accessible by HTTP protocols. These are extensively used in modern softwares around us.

**Local APIs**- These APIs generally offer middleware services or OS to applications. Local APIs have access to individual application components , which means that the delivery of services and information is more flexible.

**Program APIs** - Program APIs helps run a remote program in the local machine by using RPC's (Remote Procedural Calls)

**Hardware APIs** - They are a representation of hardware components on the software level. It allows us to automatically derive a hardware structure based on access patterns in software itself.

**Protocols and Architecture**

Enterprises increasingly rely on APIs to interact with customers and their partners. It is quite important which type of API is right for the needs before starting the development of service or the product.

APIs require clear architecture and protocols . These are the rules, structures and constraints that govern an API's operation. Today, there are three categories of API protocols or architectures: REST, RPC and SOAP.

**REST** - It stands for Representational State Transfer, is the most popular architecture for builiding APIs among the others. It relies on a client/server approach that separates front-end and back -end of the API and provides considerable flexibility in development and implementation of the application. REST is stateless, which means the API stores no data or status between requests. It also supports caching.

**SOAP** - It stands for Simple Object Access Protocol, is a messaging standard defined by the World Wide Web Consortium and broadly used to create web APIs, usually with XML (extensible markup language) . SOAP supports a wide range of communication protocols found across the internet, such as HTTP, SMTP and TCP/IP. It is style-independent, which enables developers to write SOAP APIs in varied ways and easily add features and functionality. It is tightly controlled with clearly defined standards.

**RPC** - It stands for Remote Procedural Calls, is a simple means to send multiple parameters and receive results, similar client/server approach like REST. RPC invokes executable actions or processes.

**Advantages of using APIs**

- They make our product more efficient by reducing the needs of complex code or programs which gets difficult to maintain.

- Flexibility is what makes it developer-friendly. Programmers can ask or integrate services as per their requirements.

- As APIs are running by computers, they are more reliable than humans (more prone to making mistakes) and automates the process.

- New functionalities can be easliy implemented.


![rest api](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gjfyojnzka0bn3c4vjyd.png)

Coming to the disadvantages, there are few of them. They are as follows :

They are not cost effective. Most of the times the APIs are quite costly, needs high maintanence and developer support.

Since they are the means of sending and receiving data, this layer of the software is prone to cyber attacks from hackers.

---

This is the end of the blog. I hope it cleared the basic understanding of the basic concepts of API and would help to integrate one in your project soon.

You can connect with me on : 
[LinkedIn](https://www.linkedin.com/in/sumanroy369)
[Github](https://github.com/Suman373)
[Twitter](https://twitter.com/sumanroy369)