Swagger - What is API

API stands for Application Programming Interface. It defines how two pieces of software talk to each other. There are several types of APIs, but the swagger specifically deals with the Web API.

How do Web APIs work?

Let's understand the working of the Web API through an example. Suppose we opened the Facebook on our phone and made a request to the Facebook server. 

The request sent to the Facebook server is known as an API request and the Facebook server will send the response known as API response

Note - The server will only send the data, not the whole web page. It is the responsibility of the app to display the web page.

Here, API definition works:-

  • What requests are available
  • What the response looks like for each request.

Swagger and Open API specification are mainly designed for the Rest API, where Rest is a type of web API. 

In Rest word, R stands for Representational, S stands for State, and T stands for Transfer.