Getting introduced to APIs
Tags: postmanstudent, postmanapi
Published: 2022-03-07 05:02:24

**APIs 101 with Postman Workshop** was held on 6th March 2022 at Vellore Institute of Technology, Chennai in order to introduce the basics of APIs to the students. I hereby present a summary of the learnings from the Workshop.

## API Definition

An application program interface (API) is a set of routines, protocols, and tools for building software applications. Basically, an API specifies how software components should interact. Additionally, APIs are used when programming graphical user interface (GUI) components. A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.

## Postman - An API Management Platform

Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/emwg9veo913xsuspw8sy.png)

## Postman Navigation

We will now discuss the user interface of Postman to learn about the features and terminologies that Postman offers.

The Postman UI is made up of the following components:

- The left sidebar provides access to your collections, APIs, environments, mock servers, monitors and request history.

- The header allows you to create workspaces, access reports, explore the public API network, search within Postman, view sync status and notifications, move and invite collaborators to workspaces, capture requests and cookies, access your settings, account, and Postman plan.

- The center area is where you build and work with requests.

- The status bar along the bottom allows you to show/hide the sidebar, find and replace, and open the console on the left. On the right you can launch the Bootcamp, collection runner, trash, two pane view, and access help resources.

On the right panel, you will see icons to view the documentation, comments, code and request info.

## Postman Requests

Postman makes it easy to create and send API requests. Send a request to test a endpoint, retrieve data from a data source, or try out an API's functionality. You don't need to enter commands in a terminal or write any code. Simply create a new request and select Send, and the API response appears right inside Postman.

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 is processed the server returns a response to the client.

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

- GET retrieves data from an API.

- POST sends new data to an API.

- PUT updates existing data.

- DELETE removes existing data.

## GET

A GET request has all its information inside the URL, and since URL is visible all the time, it is advisable not to use this type of request while you send some sensitive information such as passwords. For example, when you press search after writing anything in the search box of google.com, you actually go for a GET request because there is no sensitive information and you are just requesting the page with search results, you notice the same search string in URL.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgtxn7t6w0e78qxikvu5.png)

## POST

The post is an HTTP method like GET. We use this method when additional information needs to be sent to the server inside the body of the request. In general, when we submit a POST request, we expect to have some change on the server, such as updating, removing or inserting.

One of the best examples of using POST request is the login page of Facebook or the login page of other sites; you send your personal information such as the password to the server. The server creates a new account with the same information and that account, and the information is added permanently on the Facebook server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i97tmj2ngffj7uth7s1n.png)

## PUT

A Postman PUT request is used to pass data to the server for the creation or modification of a resource. The difference between POST and PUT is that POST request is not idempotent.

This means invoking the same PUT request numerous times will always yield the same output. But invoking the same POST request numerous times will create a similar resource more than one time.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7qxex6ca9v1dswqg5dd6.png)

## DELETE

The HTTP DELETE method is used to delete resources on a server. The exact use of DELETE requests depends on the server implementation. In general, DELETE requests support both, Query String parameters as well as a Request Body.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vrayt0ms92nik83gsvj8.png)

---

The Workshop helped me understand the concept of APIs and introduced me to Postman without any requirement of prior knowledge.