arbisoft brand logo
arbisoft brand logo
Contact Us

A Beginner’s Guide to API Request in Postman

Asfa 's profile picture
Asfa AkbarPosted on
6-7 Min Read Time

In today's world of software engineering, APIs (Application Programming Interfaces) play an essential role. It is very important for a developer or QA to have an understanding of APIs. So, here comes the Postman tool.

 

What is Postman?

Postman is a user-friendly tool and a platform for APIs (Application Programming Interfaces). It is used by the development team, testing team, end users, and management.

Postman allows you to simply send requests and retrieve data. There are different methods to retrieve, create, update, or delete data in Postman.

Let's dive in more to learn about Postman.

 

How to Set Up Postman:

Go to the Postman website: https://www.postman.com/
Create an account.
Check your email and verify the account.
Log in to Postman.

Explore GUI and Features in Postman

The top bar in Postman is called the “Header.” It contains:

  • Header
  • Workspaces
  • API Network
  • Search Postman
  • Settings
  • Notifications
  • Manage Accounts
  • Upgrade

 

Explore GUI and features in postman.

 

The left side is called the “Sidebar.” It contains:

  • Collection
  • Environment
  • Flows
  • History
  • Configure Workspace Sidebar

 

The main area is called the “Builder.” It contains:

  • Requests

 

The footer is called the “Status Bar.” It contains:

  • Status Code (e.g., 200 OK, 404 Not Found)
  • Response Time (e.g., 345 ms)
  • Response Size (e.g., 2.1 KB)
  • Save Response (icons to save the response body)
  • Request Time/Date (timestamp of when the request was sent)

 

Blog img 2.png

 

How to Create a Workspace in Postman:

  • Go to the Header.
  • Click on the Workspace dropdown.
  • Enter the name for the workspace (e.g., QA Test Workspace).
  • Select the workspace type, i.e., internal or public.
  • Select manage access, i.e., everyone in your team or only you and invited people.
  • Click the Create button.
  • A workspace is created.

 

Blog img 3.png

 

Blog img 5.png

 

Create an API Request in Postman:

The next step is to add an API request. For the API, I’m using a dummy API. It is only for testing purposes.

  • You can go to the website reqres.in, and we will use the following endpoint from there: https://reqres.in/api/users?page=2 for testing.
  • Select the GET method.
  • Add the URL in the request bar.
  • Click the Send button.
  • A response with status 200 is a successful request message.

 

Blog img 14.png

 

How to Save a Request in Postman:

  • In the top right of the request tab,
  • Click on the Save or Save As button.
  • Add the request name.
  • Choose an existing collection or create a new collection.
  • Click Save to Collection.

 

Blog img 7.png

What Are Collections in Postman?

In Postman, collections are a way to save a group of API requests. They help you save, manage, and work efficiently.

How to Create Collections

There are 2 ways to create collections in Postman:

  • In the left navigation bar, click on the Collection tab.
  • Click “+ Create New Collection” or the Create button.
  • Add the name of the collection.
  • Save it.

 

Blog img 8.png

  • Add requests by clicking the Save As button.

 

Blog img 9.png

 

History Tab in Postman:

The History tab on the left navigation bar contains all the requests that you have recently executed.

 

Key Points:

  • All the requests are automatically saved in the History tab.
  • You don't need to save a request for it to appear in the History tab.
  • You can reuse any request by clicking it in History.
  • It is a fast and easy way to access past work.
  • You can directly save requests from the History tab.

 

What is a GET Request?

GET is an HTTP method used to retrieve data from the server.

 

  • It is read-only.
  • Users cannot create or update data with GET requests.
  • It is used for fetching data.

 

How to Make a POST API Request in Postman?

  • Select the method “GET” from the method dropdown.
  • Add the API URL, e.g., https://reqres.in/api/users?page=2
  • Select Send.
  • The response will be 200 if the request is successful.

 

Blog img 10.png

 

What is a POST Request?

A POST request is an HTTP method used to send data to the server to create or update a resource.

  • It is used to create new data.
  • Data is in the body, usually in JSON format.
  • The server checks the data and returns a response with status 201, which indicates that the data is created.

How to Make a POST API Request in Postman?

Select the method “POST” from the method dropdown.

  • Add the API URL, e.g., https://reqres.in/api/users
  • Go to the Body tab.
  • Select Raw data and add JSON.

Blog img 11.png

 

What is a PUT Request?

PUT is an HTTP request used to update an entire resource. It completely replaces the old data with the new data.

How to Make a PUT API Request in Postman?

  • Select the method “PUT” from the method dropdown.
  • Add the API URL, e.g., https://reqres.in/api/users/2
  • Go to the Body tab.
  • Select Raw data and add JSON data.

 

Blog img 12.png

What is a PATCH Request?

PATCH is an HTTP request used to update part of a resource. It only updates specific fields, not the complete resource.

How to Make a PATCH API Request in Postman?

  • Select the method “PATCH” from the method dropdown.
  • Add the API URL, e.g., https://reqres.in/api/users/2
  • Go to the Body tab.
  • Select Raw data and add JSON data.

 

Blog img 13.png

 

What is a DELETE Request?

The DELETE request is used to delete a resource from the server.

How to Make a DELETE API Request in Postman?

  • Select the method “DELETE” from the method dropdown.
  • Add the API URL, e.g., https://reqres.in/api/users/2
  • Click Send.
  • A 204 response appears if the request is successful.

 

Blog img 14.png

Conclusion

Postman is a powerful and simple API tool that helps you create requests efficiently. Now, you are familiar with workspaces, different request types, and collections. You are already on the path to mastering APIs. Keep exploring more about Postman tools. It will give you the power to work efficiently with Postman. In this way, you will gain more hands-on experience working with the Postman tool.

...Loading Related Blogs

Explore More

Have Questions? Let's Talk.

We have got the answers to your questions.