All about Postman Collection
Tags: javascript, react, nextjs, programming
Published: 2023-12-10 18:00:00

To read more articles like this, [visit my blog](https://www.mdfaisal.com/blog)


Probably many of you are already familiar with the popular API testing tool Postman.

This is a powerful and widely used tool and one of the most important tools in any web developer's arsenal.

Today, we will learn how to use **Postman collections.** We will learn about the following things:

* What is a postman collection?

* How do you create postman **collections**?

* How do you import and export the Postman collection?

## What is Postman?

Postman is the API testing tool for testing REST Apis and GraphQL Apis, creating collections, importing/exporting collections, and much more.

[**Postman API Platform | Sign Up for Free**
Over 20 million developers use Postman. Get started by signing up or downloading the desktop app. What is Postman…www.postman.com](https://www.postman.com/)

## What is a Postman collection?

The Postman collection is the feature for combining the API in the same group, so you don’t need to find it every time; you can add all the APIs in one collection and save it.

So, whenever you need to test those APIs next time, you can open that collection, and all the details will be there for that API, like header, body, params, cookies, etc.

## How do you create Postman collections?

Let’s see step-by-step how we can create a new Postman collection.

### **Step 1:**

You need to click on the “**New**” Button, as shown in the screenshot below.

![create new collection button](https://cdn-images-1.medium.com/max/2534/0*VMpLE8JVmuV4gx4A)

### **Step 2:**

On the popup screen, click “Collection,” as shown below.

![Create collection](https://cdn-images-1.medium.com/max/2538/0*1-KkhbROtZD7pdWY)

### **Step 3:**

After that, give the name of the collection. You can also add an authorization method that will be used for every API call you make in this collection.

![Authorization method for a collection](https://cdn-images-1.medium.com/max/2696/0*wGjuPgmYj1DltLod)

You can also add a Pre-request Script, which will execute before every request in this collection.

There is another option for Tests that will execute after every request in this collection. Variables are a handy feature where you can define global variables and use them in APIs belonging to this collection.

There are lots of features like documentation and comments, etc.

### **Step 4:**

The popup menu will open after you click on the three dots on the collection name.

You can create a new folder / new request. You can add requests inside the folder as well.

Apart from that, there are other options, like renaming collection, duplicating collection, deleting, running collection, exporting collection, and many more.

![Add a request](https://cdn-images-1.medium.com/max/2532/0*q0peiDQK3MGdeBgj)

### **Step 5:**

After you click on the Add request, you will see the below screen where you can add the request URL.

Then select Request Types (GET, POST, PUT, PATCH, DELETE, etc.); you can add authorization like bearer token and modify headers and body.

You can also add Pre-request scripts and Tests, as I showed earlier when we created the collection. After that, click send, and you will get the API response.

![Add a request](https://cdn-images-1.medium.com/max/2806/0*6ApZCop6B9Z1lae7)

You can follow all the repeat steps 4 and 5 to add more requests/folders. You can also add documentation and comments, the same as a collection for each request.

## Import and export postman collection

This is an essential part of any API because you can share the collection with other users, so others don’t have to create it; they can import it and use it directly.

Click on the three dots at the right side of the collection, and in the popup menu, you can select the export option.

After that, click on the Export button to see the popup for saving the file. Give the name of the file and click on save.

![Export API](https://cdn-images-1.medium.com/max/2536/0*oBxMy2kaRCuZn5ZW)

You can export the Postman collection and share that file with others. Now you can also import other collections as well.

Click on the import button, and you will see the below screen where you need to click on upload file and select that file; you can also import the collection from the link.

![Import API collection](https://cdn-images-1.medium.com/max/2674/0*y7JFKNZKujpXkpe5)

You can also import this collection to the mobile app and test it. This is possible by using the [API Tester](https://apitester.org/).

You can download the app as per your platform, Android or iOS. Using the API Tester, you can test any API directly from a mobile phone on the go from anywhere in the world.

**Android**— [Google Play Store (API Tester)](https://play.google.com/store/apps/details?id=apitester.org)

**iOS**— Apple App Store ([API Tester](https://apps.apple.com/us/app/api-tester-debug-requests/id1575521212))

After installing the application, you need to click on the “plus” icon at the top right-hand side and click on Import the Postman collection.

![Import API from the file](https://cdn-images-1.medium.com/max/2000/0*0dnSyFPwZTpjXG4r)

You can choose the file or link to import the collection; as you select the Postman collection file, you will see all the requests inside that collection are imported.

Now, you can make API calls from your mobile phone itself.

![Image from mobile](https://cdn-images-1.medium.com/max/2000/1*rCq_gpDJ0lOZ49UL0PJxUw.jpeg)

## Conclusion

In this article, I explained everything about the Postman collection and its advantages; I have also shared about importing and exporting collections.

After following all the steps, you can create your own Postman collections, share them with others, and import others’ collections.


**Have something to say? Get in touch with me via [LinkedIn](https://www.linkedin.com/in/56faisal/) or [Personal Website](https://www.mdfaisal.com/)**