DEV Community

Shyam-12
Shyam-12

Posted on

Application Programming Interface:101

There is an API (Application Programming Interface) build for almost all the things that we use on a daily basis in our lives. API lets products and services communicate with other products and services without having to know how they are implemented. What does it mean actually? Let's understand this.

Lets have an analogy to understand API, which is the famous Customer-Waiter-Chef Analogy.

Image description

Think of API as a 'Waiter' serving in a restaurant. Now when you visit a restaurant, you go through the menu and you tell the waiter (request) your food order and the waiter passes down your order to the Chef who prepares the order (response) and then the waiter brings the food and serves you. In similar way Imagine you are a client and you are sending a request to the waiter (API) and the waiter will send it back to the chef(server) and in return the chef(server) will send back a response that the food is prepared and the waiter(API) can serve it or maybe a response that the ingredients are not there so that particular food cannot be served i.e. an error like 404.

Let's have an another analogy.
We all have used Ola or Uber for booking cabs right. Now, when we book a cab we can see the google map there, in which we can see the cab's current location, our location and we can track the cab, now They have made the app but to show the app they didn't create a map of their own but instead they integrated the Google Map API with their map and so instead of building a map they can simply take the help of API being provided by Google. So that lead to making development much easier as without any access to the Google Maps Codebase or without knowing how the codebase is implemented they are able to integrate the map to provide service. So, API helps us build on existing technologies, You don't have to build everything from scratch and you can use services or product which has already been built by someone.

What is POSTMAN API?

Postman is an API platform for building and using APIs. It simplifies creating, using and testing APIs with User Interface. Before Postman we needed to use terminals to send/receive request or response to API which was difficult for beginners but Postman provides an easy to use User Interface which is beginner friendly.

Interacting with the API

Postman is a client that allows us to make request and view responses from the server. Let's look at this point in detail. APIs provide a structured way for one application to access the capabilities of another application. Typically, this communication happens over the internet by way of an API server. A client application (like a mobile app) sends a request to the server, and after the request processes the server returns a response to the client.

A request includes the URL of the API endpoint and an HTTP request method. The method indicates the action you want the API to perform. Here are some of the most common methods:

GET request - retrieves data from an API.
POST request - sends new data to an API.
PATCH and PUT request - update existing data.
DELETE request - removes existing data.

So, basic steps to make a request are:

  1. URL - to identify target server and resources
  2. Method - defines the required action (GET, POST, PUT etc)

This was a very simple Introduction to what is API and a simple intro to Postman, There are a ton of resources you can use and learn more about API and Postman including
https://learning.postman.com/docs/getting-started/introduction/

Top comments (0)