What is API...?

Makesh SMakesh S
3 min read

API....

API is called Application Programming Interface. It is the way through which different types of applications communicate. These may differ in terms of technology / language.

  • In the previous article, we have seen the Client-Server architecture. We have 3 layers namely Presentation Layer (UI), Application Layer (Business Logic) and Database Layer (Where data is stored).

  • When a user sends a request from the UI, the Application layer takes the request and get's the output/response from the database layer and displays it to the user through UI

  • The application Layer (Application Programming Interface) contains the business logic and is said to be API.

Simple definition for API:

  • Application - The application which are going to be interacted

  • Programming - Having programming logic

  • Interface - A mediator between the front end and back end of the application

What is API Testing...?

When we test an application layer that contains the business logic, it is said to be API testing. Through API's we are getting the response for a particular functionality.

This reduces the dependency of the UI testing on the business logic.

Why API Testing...?

  • When a user develops an application, priority goes in a series like Database development, API Development(Business Logic) and UI Development. These are performed by a different teams.

  • The main requirement of the application is to provide the expected output based on the business logic when we provide any input. This should be tested as a priority.

  • API contains the business logic which is important for an application. If the logic/ functionality of the application is handled properly, then these API's are integrated with the UI.

  • If API testing is performed, this handles 80% of the application testing and the remaining 20% can be tested when UI is developed and integrated with the API's.

  • API Testing doesn't concentrate on the look and feel of the application.

API Restaurant Analogy

  1. The customer (Client) will place the order from the available menu. This is said to be a Request. The waiter(API Request) will get the order from the customer and send the requested food to the cook(Database). The Cook prepares the requested food and sends it back to the waiter(API Response). The Waiter serves the food (Response) to the customer (Client)

  2. Another example is using the Yatra website.

    As a user, I need to book a ticket using the application. I will send data like From, To, and Date of travel from the user interface. Yatra (Client) will send the request to the various airline which is available. Let's assume AirIndia, IndoGo, SpiceJet, and JetAirways are the various airlines that provide flight services. These airlines have their own API's which was developed and they share the API's with the travel agencies (Client) like Yatra, MakeMyTrip and other agencies. They (Client) send the data to the airlines in a particular format. The request hits the database of the airlines and receives the response. This response will be displayed in the Yatra UI where user can have access and get the details.

Types of API...

  1. SOAP - Simple Object Access Protocol - Old and organisation is not using SOAP

  2. REST - Representational State Transfer - Currently most of the organisation is using REST API's

Difference between API and Web Service...!

All Web Services mean an API.

0
Subscribe to my newsletter

Read articles from Makesh S directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Makesh S
Makesh S