ΕΣΠΑ
What is an API?
Maria N.
Tuesday, 15 February, 2022

An API, which stands for Application Programming Interface, is a simple bit of programming code that allows applications to communicate with one another using data transmission. APIs are not a kind of server but a set of standards that either permit or deny requests during data exchange by governing the access points of a server.

Think about a backend application that we want to connect and communicate with and a user who will use another application as his proxy. In this case, the API is the messenger between the user and the backend application. It delivers requests from the user to the servers and responds to the server to the user. The response format is a dataset, likely in JSON or XML.

Types of APIs

  • - Based on protocols
    •            > Representational State Transfer (REST)

It is a software architectural style created to guide the design and development of the architecture for the World Wide Web. It is stateless and separates the concerns of the client and server.

When a client makes a request via a RESTful API, it transfers a representation of the state of the resource to the requester or endpoint. This information is delivered via HTTP more commonly as a JSON (JavaScript Object Notation) or plain text. JSON is the resource's state the most generally popular programming language to use because, despite its name, it’s language-agnostic, as well as readable by both humans and machines.

 > Service Object Access Protocol (SOAP)

It is an XML-based protocol for accessing web services over HTTP. It is used to accomplish data exchanges between heterogeneous applications like web applications designed in different programming languages. The information is delivered by using XML (Extensible Markup Language) as an intermediate language of data exchange between the different applications. Like REST it is also designed to work over HTTP but it differs because of using only CML as data format.

The current trend in the industry is largely toward REST APIs and away from SOAP-based APIs.-

  • - Based on release policies
    •       > Open APIs

These application software interfaces, also called public APIs, are publicly available to any software developer. The Open API Definition suggests that all features of such an API are public with relatively few restrictions. Restrictions might include the necessity to register with the service providing the API.

                    > Private APIs

These APIs are providing an interface that opens parts of an organization’s backend data and application functionality for use by developers for improving solutions and services within an organization.

  • - Based on use case
    • > Database APIs. 
      This type of API provides a communication layer between an application and a database.
    •  
    • > Web APIs
    • This type of API is an application programming interface for the web and it is the most common use case. It provides a machine-readable data transfer between a client and a server by providing easy syntax to complex code.

Examples of API usage

There is a wide range of companies that are using APIs for their operations. 

One common usage of APIs is the Online Payments Systems. For example, PayPal is a well-known organization that utilizes a collection of APIs to transfer the user’s money.

Another technological sector where there is high usage of APIs is in Analytics. For example, a very famous service known as “Google Analytics” is part of the used by many people platform called “Google Cloud API” where the most used part is the Management API and the Core Reporting API.

Pros and Cons of consuming APIs

  • - Pros
    •    > Easy access

You don’t have to know all the structure of the system you want to get some data. You only have to use the documentation to identify which endpoint of the API could provide you with the appropriate information.

  •           > Bandwidth consumption

Because of the response format, a REST API seems to return all the information needed without any extra load of unnecessary metadata or repetitive descriptions

  • - Cons
    •    > Random performance

It is pretty clear that when we have to consume a web service that may be public, the performance is affected by many factors such as user load, network performance, and packet size. 

  •           > Lack of customization

Because of the predefined routes that we have to use to get data we can’t create a response based on our needs if it is not provided as an option from the API.

To sum up

As mentioned above, using a rest API for getting data from a third-party system is the best practice if it meets your needs. Also, it is the fastest implementation because of the easy installation. But if you need more customized data and without the risk of performance instability maybe you have to avoid this solution.

Giannis Simantirakis, Business Intelligence Consultant, WITSIDE

Share to
<- View all articles

AI in Action: Download Form

Blog Post Questionnaire